From patchwork Sat Dec 3 22:41:42 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: 29348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1550795wrr; Sat, 3 Dec 2022 14:43:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5lTVI72UL0Xqe0MJbqpGpQ8KiHGWhqhhIML5qK+3QwMIYE+fuTSQj1E/+wbD159bejXmkQ X-Received: by 2002:a05:6402:370d:b0:462:1a67:75ef with SMTP id ek13-20020a056402370d00b004621a6775efmr51637633edb.16.1670107437462; Sat, 03 Dec 2022 14:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670107437; cv=none; d=google.com; s=arc-20160816; b=ae/KTBJU2S9uolxBKZhNYCne8j/olLWCHrd0jBFwjR/5HdduFKew2VAFgnalKYkAn7 jHemRAktAh/xaMTUF81UpqGRfVL1ILFD7aW7jycR3IPx04vyUoTAte8FDNnYwfTVlPgv zurWw8ZM2WqoY3VOb/XOD0UD9oXAgUNp9wOJ4Th6EYbuQ/NImFn+gSqXdLWdF58t0wm+ TKW87w0gnT+6gXwa4nOs8Hj97khcYVObcRLmyRFWilzV5Jyo75ZOO8K9btSMKKw5x0PO 6wixofxvqutYBgJZgA5Zs+OYEYmHVp+y0PH+12Y848jXqe61hgjopOZDFthb0J2/PdqP OZbg== 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=crbVMJQ2kqxIIKPitFZehVSLYa6oQZoXw3RhLd2htU8=; b=z6rLB5HtBvdpg//H9IDIZhgxwP3O2suW51nIVfTHsU2EQJ8L7eHF1SUPe2YEdSmN3Q 0AJ6xVDz0or8uTnUC+e8jcfA7PWBQQwG3s9+VmnI3moAHzehxn0xMAdlpdwHNLPFxnam /vyXL/adYGU/7MAKsUdvHMpogVeGjCjejrtiPJgJ3zgnqqZsBXpyjT9ZOSvo9JNIY6+h ZsuKjdNyJCN+8cbjGzCNVVbBWLCpjQsV5kJIMYxYsxWXq/POfnOcXwfQUN5hTDd7uXba Yb1uMFbJpVjvY1pHtJb8ogPUywzv5pk1T1w24P9ZdwqNIRi94bPtv359fbwKkEnyp7Z8 wc4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XyCKtPIr; 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 v10-20020a056402348a00b0046c38a4d05fsi4279477edc.484.2022.12.03.14.43.33; Sat, 03 Dec 2022 14:43:57 -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=XyCKtPIr; 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 S229611AbiLCWmT (ORCPT + 99 others); Sat, 3 Dec 2022 17:42:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbiLCWmN (ORCPT ); Sat, 3 Dec 2022 17:42:13 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20D791D655; Sat, 3 Dec 2022 14:42:13 -0800 (PST) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B3MSNdX014991; Sat, 3 Dec 2022 22:42:07 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=crbVMJQ2kqxIIKPitFZehVSLYa6oQZoXw3RhLd2htU8=; b=XyCKtPIrJtwHQeok+OQEwLUmULQgFcGNZxGRMAt676AJ0C0mzmyHaTuR1YfHOoV8ckil cASMUC91axR7oaO2WfCkLCnBVQq7UgLkWq6FV12Rkbcm3cjO+t5+BoM2tp5W0zvTfUL4 jN9IqdkDvF96U265n1j/3G8k4g37CXx4QgtLLwukWsKOel4xpED4I9KFWSZ4H8hqR0Dz biERICwX0wzcf1i3neJvTLycvmu68ywh8PGWhVbeo+IRzPquNBHx28J/ZFw6WDuM+AU2 6iCf9dniVAgiees0+VWksWhKaTV/EmW0ezf7rl9se0GvtYPQtCiHUJFbr4QhxuIPvsMn vQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m7wff1b9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 03 Dec 2022 22:42:07 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B3Mg6kk004800 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 3 Dec 2022 22:42:06 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; Sat, 3 Dec 2022 14:42:02 -0800 From: Akhil P Oommen To: freedreno , , CC: Akhil P Oommen , Abhinav Kumar , Daniel Vetter , David Airlie , Dmitry Baryshkov , "Duoming Zhou" , Greg Kroah-Hartman , Johannes Berg , Rob Clark , Sean Paul , Subject: [PATCH 2/4] drm/msm: Fix failure paths in msm_drm_init() Date: Sun, 4 Dec 2022 04:11:42 +0530 Message-ID: <20221204040946.2.I49dfc3654040be61702e491f1aa63d3a5f308852@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20221204040946.1.Ib978de92c4bd000b515486aad72e96c2481f84d0@changeid> References: <20221204040946.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: FWq7KCjSapIa27EHnuu0-zGpuKgT0wHH X-Proofpoint-ORIG-GUID: FWq7KCjSapIa27EHnuu0-zGpuKgT0wHH 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-03_12,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 impostorscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212030202 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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?1751234576157346372?= X-GMAIL-MSGID: =?utf-8?q?1751234576157346372?= Ensure that we do drm_dev_put() when there is an early return in msm_drm_init(). Signed-off-by: Akhil P Oommen --- 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; }