From patchwork Wed Dec 21 15:09:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil P Oommen X-Patchwork-Id: 35395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3578871wrn; Wed, 21 Dec 2022 07:13:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXvo8uR93NWJ01RpbLxct9OXoP19DiBYL92llDUlr5JEufIHLVPLZSTZLds8CyjoiVqpc7BZ X-Received: by 2002:a05:6a20:939c:b0:ac:2424:e873 with SMTP id x28-20020a056a20939c00b000ac2424e873mr2947304pzh.17.1671635615588; Wed, 21 Dec 2022 07:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671635615; cv=none; d=google.com; s=arc-20160816; b=zY/QyyozgaWcwTvmG1uhsuydkzuozSTf1x34GVMd329spWKfueUHDiN+ENzXcmSt83 Kp0VxRt8kqn0OMiGy+KqtYRQW5v+snxeGLFpcx6MpgzLRes2H9HlwrjmMpKOdo+sMtEb XDaj05mmIff1UKiF7q0XqAcolX/0ptCY8/D9KuMKdu54vjST0O5t43FdQ9ueSCyeyaAE sDmcX6HlKwtwyQ9mDISkuJl+DmRwh2u2ErWYimmexsM7ApnifVhLqSuma2WWycnklyZE JlNxb1xA3Uj5G8qo85/oQtFrw0Aa5Lajx+KTP0KOjvnnj2pZS8D+jh3VV7UznCLfOYcL KSlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wY1NExqDqDzXSUoLUkd9icvRcHISZwHFBbiXiGLjU18=; b=REjH7tUjwcALDdMNIEQylscfobXSW2NH2m5qpnfk3HQZTddbhEh8FEYkhRNNqsHlX1 m2FJ/z/4x7a03r550cg9cN20yIdNfSy64HccPwi3GRf9t71KZ057iqeXBlohJxES+Ef6 UdPRzxYx6Z/ZeyY8XNlxlttnUSldQxTfQckmUX4ALQ8ontTWoGEXA6KmPkiWzjL+xZMF NUmP7yNKDM4gXinxT5IiLa7ZzgUYGv7nTVpPe5/MmvwkZPWiXuIbKNPpPPBLZfuq3Ypu /I8Thzcd5LQ4og31ehPKpselT/nctOldu+Ax4a9/2pZ5FvY6Ah+0i/LEqbUkZCUhfY8y 6Drg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IMjNmEm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a63f648000000b0046f4d395e6dsi17164301pgj.573.2022.12.21.07.13.22; Wed, 21 Dec 2022 07:13:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IMjNmEm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234411AbiLUPKf (ORCPT + 99 others); Wed, 21 Dec 2022 10:10:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234218AbiLUPK2 (ORCPT ); Wed, 21 Dec 2022 10:10:28 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AB2C22B01; Wed, 21 Dec 2022 07:10:28 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BLCp8hW005691; Wed, 21 Dec 2022 15:10:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=wY1NExqDqDzXSUoLUkd9icvRcHISZwHFBbiXiGLjU18=; b=IMjNmEm5TWITSHhb4i6iSnY8YzGIo0obXCfmoEojQRnyUh7oy3NkmxS3SEanqnis25uW CuzRWAb2vUwUEZCHVGme+XAwoCLPqjJ6QtvLhIji9NkBKm/ElfKtDW3fXTSy5K6RT7hT 8e7LqirHCanS580SFZwWywkoaEX0nBjSWl/Gv3Vzol/fdUggUKqWCYp/gZkuDiiu4UT/ z4oxvWaNcUpem5UaAwlp4WAIMRQY+3KmuzBtiBsGaq5tST0idtO+hnYb6YXtQrF6Ub7E Nwxmz2G+kRFiHWX+WoN02JGXowK01yZlgsn5wuxV+niUxodUYXPS6NPh9k5Mq7HWl11k qw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mkkxct3aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 15:10:19 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2BLFAJat014447 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 15:10:19 GMT Received: from hyd-lnxbld559.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 21 Dec 2022 07:10:14 -0800 From: Akhil P Oommen To: freedreno , , CC: Akhil P Oommen , Abhinav Kumar , Brian Norris , "Daniel Vetter" , David Airlie , Dmitry Baryshkov , Duoming Zhou , "Greg Kroah-Hartman" , Johannes Berg , Rob Clark , Sean Paul , Subject: [PATCH v2 2/4] drm/msm: Fix failure paths in msm_drm_init() Date: Wed, 21 Dec 2022 20:39:57 +0530 Message-ID: <20221221203925.v2.2.I49dfc3654040be61702e491f1aa63d3a5f308852@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20221221203925.v2.1.Ib978de92c4bd000b515486aad72e96c2481f84d0@changeid> References: <20221221203925.v2.1.Ib978de92c4bd000b515486aad72e96c2481f84d0@changeid> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: z0sY5w4UyLCtM1Pk0LRPjEutvwkITRBd X-Proofpoint-ORIG-GUID: z0sY5w4UyLCtM1Pk0LRPjEutvwkITRBd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_08,2022-12-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 clxscore=1011 priorityscore=1501 spamscore=0 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212210126 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752836987328047062?= X-GMAIL-MSGID: =?utf-8?q?1752836987328047062?= Ensure that we do drm_dev_put() when there is an early return in msm_drm_init(). Signed-off-by: Akhil P Oommen --- (no changes since v1) drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 3 +++ drivers/gpu/drm/msm/msm_drv.c | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c index e75b97127c0d..b73031cd48e4 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c @@ -129,6 +129,9 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev) } priv = drm_dev->dev_private; + if (!priv->kms) + return; + kms = priv->kms; if (kms->dump_worker) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index eb5b056ce3f7..544e041dd710 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -149,6 +149,9 @@ static void msm_irq_uninstall(struct drm_device *dev) struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; + if (!priv->kms) + return; + kms->funcs->irq_uninstall(kms); if (kms->irq_requested) free_irq(kms->irq, dev); @@ -265,8 +268,6 @@ static int msm_drm_uninit(struct device *dev) component_unbind_all(dev, ddev); ddev->dev_private = NULL; - drm_dev_put(ddev); - destroy_workqueue(priv->wq); return 0; @@ -441,12 +442,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev); if (ret) - return ret; + goto err_drm_dev_put; /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); if (ret) - return ret; + goto err_drm_dev_put; dma_set_max_seg_size(dev, UINT_MAX); @@ -541,6 +542,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_msm_uninit: msm_drm_uninit(dev); +err_drm_dev_put: + drm_dev_put(ddev); return ret; }