Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp25421ybi; Thu, 23 May 2019 22:51:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVhLBfnplm63pn8j7bKH1G4DYYd0aG9QVsvos5tbPEIlKlUClOzP3A4YJYn/W2QFtXuXla X-Received: by 2002:a63:1160:: with SMTP id 32mr103905863pgr.106.1558677105317; Thu, 23 May 2019 22:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558677105; cv=none; d=google.com; s=arc-20160816; b=bXk/T7t4ZSc5F62X3viAb9NRv5M0tmnFWDVZVSHZiW+/KcmObQVAETpxaO0m50VPyn PoVQGmNqPEjVHqha4I1Zg0bl/ZLq5sd0RRkN7YbSyUgZCPOXVX6rgldDC1nGq4Z1F9dY P63ajMUTGeROSGuwQE1eAMPCRxYEe9TMfw68M2KCA8G/iW5wVkdwT3FOIqgumb85iePL icDAl/RXRv5nbKq+7r/E0KuXPBCGJsGsmds6CFRc+pHtlFGvO4LLDAnR4BXwmUkNAr/X 9JsOrxS5pJ2/RnOHLv06G0WYwxv1s2u/rT6YD8LQkU0rbh1MIopQBF4fAwUjV0p6Fxop EEfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=hSeRj+9N9TPIxY8/Mpoj3Q9sjDYtHzAs3H0QgaCHKjE=; b=y7XdI7k4EozkPB4bq4ETtC1J+L55gXjz6jf8bN7qRKcjyBR5f4qRxJhqzuu4Tu3P9M 8yJZIw+UPYRVeEBM0qJsaNPk8i9luj11YJOqaeLLOS7kq0EaZzTwxFE2wKlBDX8RZr2o AILgX34+670vZiob/jZsVICqsWZHLFQwv/D8niCqZE2XZHaH5ToT1y+XCCFtxeo9CRRy QIHBv8TNfPxGL/SKvdbuSPv7EyLh1O8QNloxOPPG58A4f2twb9PwM6Fg6Vqm1cOEyUW6 qnjIZ1tVfDYhu0uE74NSXYg8tVHOUiPzb/QxJaNj5/SZa2yl5LvIeIGrS2cwhWloEhKs 8sFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si2557743pll.428.2019.05.23.22.51.25; Thu, 23 May 2019 22:51:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388451AbfEXFtU (ORCPT + 99 others); Fri, 24 May 2019 01:49:20 -0400 Received: from inva021.nxp.com ([92.121.34.21]:54904 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388232AbfEXFtT (ORCPT ); Fri, 24 May 2019 01:49:19 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 052572000AC; Fri, 24 May 2019 07:49:17 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 19B9D200088; Fri, 24 May 2019 07:49:12 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C1288402D6; Fri, 24 May 2019 13:49:05 +0800 (SGT) From: Anson.Huang@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, leonard.crestez@nxp.com, abel.vesa@nxp.com, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, hyc.nju@gmail.com Cc: Linux-imx@nxp.com Subject: [PATCH RESEND 2/2] soc: imx: soc-imx8: Correct return value of error handle Date: Fri, 24 May 2019 13:51:01 +0800 Message-Id: <20190524055101.3424-2-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190524055101.3424-1-Anson.Huang@nxp.com> References: <20190524055101.3424-1-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang Current implementation of i.MX8 SoC driver returns -ENODEV for all cases of error during initialization, this is incorrect. This patch fixes them using correct return value according to different errors. Signed-off-by: Anson Huang Reviewed-by: Leonard Crestez --- drivers/soc/imx/soc-imx8.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index d5badde..2183edf 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -102,7 +102,7 @@ static int __init imx8_soc_init(void) soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) - return -ENODEV; + return -ENOMEM; soc_dev_attr->family = "Freescale i.MX"; @@ -112,8 +112,10 @@ static int __init imx8_soc_init(void) goto free_soc; id = of_match_node(imx8_soc_match, root); - if (!id) + if (!id) { + ret = -ENODEV; goto free_soc; + } data = id->data; if (data) { @@ -123,12 +125,16 @@ static int __init imx8_soc_init(void) } soc_dev_attr->revision = imx8_revision(soc_rev); - if (!soc_dev_attr->revision) + if (!soc_dev_attr->revision) { + ret = -ENOMEM; goto free_soc; + } soc_dev = soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) + if (IS_ERR(soc_dev)) { + ret = PTR_ERR(soc_dev); goto free_rev; + } if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0); @@ -142,6 +148,6 @@ static int __init imx8_soc_init(void) free_soc: kfree(soc_dev_attr); of_node_put(root); - return -ENODEV; + return ret; } device_initcall(imx8_soc_init); -- 2.7.4