Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp591327pxb; Tue, 14 Sep 2021 04:40:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD9s53IoIFazH1xT5yTzY10HK0hr0SgjBaQwHgV0JAlzsexQj5eSIvJWv7Csc9hJFu6ESZ X-Received: by 2002:a17:906:4ed2:: with SMTP id i18mr17846029ejv.528.1631619641702; Tue, 14 Sep 2021 04:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631619641; cv=none; d=google.com; s=arc-20160816; b=iq7VQtDjHviZ/EiYL4lujmiEq1z6YgS4QTRK8ZG2ZTGFF19Ahhg4JZAjQe9T142bGb pSmDtEjDxyIiXGTOn4JuZBQnLQCnjQK8P/O0q1QnH7JRu2EQ9QtGXSrPY5udBB7j7vHP QuGyWd9TzjDCHooPAfhsj3vD7XnQidfJsvENV/gXHH8RoJyDGTT1aPmgAukvGGjAN3of +h4f4+cSjYOQ/NS5xJxEKNln3aGwMmgBqFiz8DxOeiev8VAVc5DWyKHPboGWdk32fRGd W8VKYpo+dM6SyG6gfvoZCgVdjQ4v+IXqjdAcmw8OldYzUQYZcHe5fqwoTD35GGaA2hZ0 jsrg== 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; bh=+mua33nEz0EelyqXv5ZwbAwSSLof8LgOKANXLUOP3SY=; b=hvmjJfZLLk3gBgViAPYI4bSOogaPSBiqGMCqXZHFg4dDuCeyTfagMh5wAeGQ5kw6Y/ uOC4q1WlOuvvSWaNrz7L2RLYB3mA+hgJU1wS3iTO2rNet5hO/BFrxtP6vxpgbhLurxk7 IC0rogklkh2C6u9xo6xTyOE2HeVfbqfnZkEX+ebe3J3xB+wshg7UsbMwQZwtErokvjGe mKwRaF0shqdjOlPJMoPVk5zpmvJRZn8NvlbZelLIRfCCT7j8hOUU89BlsKnLP00P+1G8 qVGwQ3H+G0mzAkdJJkLggzY2TJ2RpjIAMArfLkgLTc9xfjscDbYpR5H838s+Oz/yw27/ lORw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si739506edt.292.2021.09.14.04.40.17; Tue, 14 Sep 2021 04:40:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232252AbhINLjr (ORCPT + 99 others); Tue, 14 Sep 2021 07:39:47 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:53980 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232278AbhINLjn (ORCPT ); Tue, 14 Sep 2021 07:39:43 -0400 X-UUID: 3d41c48899e24b0d8bab95d05ea38e8e-20210914 X-UUID: 3d41c48899e24b0d8bab95d05ea38e8e-20210914 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1720744512; Tue, 14 Sep 2021 19:38:22 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Sep 2021 19:38:21 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 14 Sep 2021 19:38:20 +0800 From: Yong Wu To: Krzysztof Kozlowski , Rob Herring , Matthias Brugger CC: Krzysztof Kozlowski , Joerg Roedel , Will Deacon , Robin Murphy , Tomasz Figa , , , , , , , , , , , , , Ikjoon Jang Subject: [PATCH v4 06/13] memory: mtk-smi: Add error handle for smi_probe Date: Tue, 14 Sep 2021 19:36:56 +0800 Message-ID: <20210914113703.31466-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210914113703.31466-1-yong.wu@mediatek.com> References: <20210914113703.31466-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add error handle while component_add fail. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 33b6c5efe102..b362d528944e 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -338,7 +338,15 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) pm_runtime_enable(dev); platform_set_drvdata(pdev, larb); - return component_add(dev, &mtk_smi_larb_component_ops); + ret = component_add(dev, &mtk_smi_larb_component_ops); + if (ret) + goto err_pm_disable; + return 0; + +err_pm_disable: + pm_runtime_disable(dev); + device_link_remove(dev, larb->smi_common_dev); + return ret; } static int mtk_smi_larb_remove(struct platform_device *pdev) -- 2.18.0