Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3396079pxt; Tue, 10 Aug 2021 02:36:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQI6Kp9fd/r7GvyMw99B1mbWB50pgjrIuoK+74hfpZzSZAo/g37f7DpRKfvcjTnlaE5tp3 X-Received: by 2002:aa7:d7c1:: with SMTP id e1mr3764883eds.251.1628588218428; Tue, 10 Aug 2021 02:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628588218; cv=none; d=google.com; s=arc-20160816; b=AC810hxUpHZbP0wGNX+FSXVZUCbIDV3/TF/5KorQIEc3A9FUgEDMuoKdctiBfZ6Owp 524iPJ5Ze+A9gGYxFmLnb22B2WWabzOqIgPyzxJU8+d6CfGU+TdPIJcbcPrnS3CWLjBP l1i8K3R9VTwYp1YFinCZaCyhQyq94yAPX6oC9kjbCDvMYHBsso17IQU1XmnVhbguNQfS xL92KY8N3/2ZpY9fyGGHTxNeEKLb401zatyxn8OgbGb6aZDyDqTUMB6Nm7jcIF2H8689 CefqO579QmELJ/XP+Dj7qZClYqVWTTvVUH/uTY+fBwy+/Mhofl7aBj773SIw7+v7Q/BC LHpA== 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=MDuADEYEX6Hhg36yB+TwUYPFLmnSSdPP5ZAn+qTDHqYPA7rwq4rUQbIGZ9loXDoQDO 7c8UZmg8JKxZJashHpI6cjsRzDpWI2mPfy/T+ifk902sRzsssT+CozmIlXTm7YPoH295 zyMKkdY70Wh+l79S5hhDlkIVK+QZqqE6WC72GZUMtQayjA0ZBkMAeHfW008+F3lNzYlk +7IyTeoxy4zMVRj+bKUdZxAstXKeTyodvW1V2EN9GvO3NgkEmg6Rf7ZodYWSURM+TXpz zqBUo/4ennZT5kSgjiZhZYA3loBS4UjRblT3EXpz2eaDOYo+g6S/CoJtXW8v/orYRIQ7 XevQ== 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 v17si19700932edc.442.2021.08.10.02.36.24; Tue, 10 Aug 2021 02:36:58 -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 S238140AbhHJIMB (ORCPT + 99 others); Tue, 10 Aug 2021 04:12:01 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:39498 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238023AbhHJILJ (ORCPT ); Tue, 10 Aug 2021 04:11:09 -0400 X-UUID: c987ace2eb2d49798ae1521c10d5ad64-20210810 X-UUID: c987ace2eb2d49798ae1521c10d5ad64-20210810 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1700904048; Tue, 10 Aug 2021 16:10:05 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 Aug 2021 16:10:03 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 10 Aug 2021 16:10:02 +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 v3 06/13] memory: mtk-smi: Add error handle for smi_probe Date: Tue, 10 Aug 2021 16:08:52 +0800 Message-ID: <20210810080859.29511-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210810080859.29511-1-yong.wu@mediatek.com> References: <20210810080859.29511-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