Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5836017rwj; Wed, 21 Dec 2022 07:37:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+I2KWaXCf8/Sn7xi6b9qR8hMy5cAuV40U1UoMbeG0q+c87MOz7kZQdM5JFqiIQCRVfWdN X-Received: by 2002:a05:6a20:a687:b0:af:7cf6:1d4b with SMTP id ba7-20020a056a20a68700b000af7cf61d4bmr3485096pzb.23.1671637037640; Wed, 21 Dec 2022 07:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671637037; cv=none; d=google.com; s=arc-20160816; b=PBwKonosdY0PcG/ae6iiYqej+bpXOyssVFvjxe17LXIv8TGkpDvNqbgQfQA8eEEy+x PmmtklSYF9xRPR9BrsyO8zYqRgUG0PzhH3wBI6CHJiRdt080mOOUWOr96gPnORq0tkbu RXe2FGaLZV2Ssp3sncTcIrb5bEQhK+RqjOQ2RZz932Cu54ojgyJqf7i5MANoqk6C2wHI IOtbXgfoc01640DVyHkyX3tu7RQMWbxQbTfvjLcJeamW//7ENIUmUnnecD0D/EeRn25e qA+PRr218vUQb0udulEInIn+FMMfeVRgZs/OqNTOYpJHPF5hecb4VxR1K+VwdZbhm3Qu aihg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b00478446557b9si17577509pgk.677.2022.12.21.07.37.07; Wed, 21 Dec 2022 07:37:17 -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 + 68 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 Content-Type: text/plain 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 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; } -- 2.7.4