From patchwork Mon May 31 14:53:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 450521 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp899601jao; Mon, 31 May 2021 07:55:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiV7rVDKl94avksVgjJmCr8HcaAz0Ijh9DiZD5sNQhIQZdZXDGlqWMUlXXk/D2O+vK9ckz X-Received: by 2002:a05:6402:645:: with SMTP id u5mr5799681edx.293.1622472941449; Mon, 31 May 2021 07:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472941; cv=none; d=google.com; s=arc-20160816; b=aqMsfVXAIJtZgeBPVBP/LM+bcYODTAUAW9q2w+g0mzgsg7MvM5MRihLrBE1+AzcdZr hPRTh+rvkOQ7gvFNv3sM3L3cYRt1rMQ61oYjl0NkGbfaC5nX2vuUEWum1Mks6SfIf1vo fnlKPKGdlc9b4wpRK/yvUJa50bzSivkhECjdnVSSwdrpgK1WYlXdAm9+GWWjqD9JVp+6 yq9pDZmpeaAGkZml7xnoK+UkiVYg50hte8sW8RMdphINt4Gorn3F+apGvtfTuvMFFU+Q Z9DIvmsmZXgNmvuALXbigfOu4F+SOzAV3cLItFUyE+pmGRIkAJf8TQN3z2xjfZ5kGgaS kmDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OSWVFNJCebZT8ZGSmSpUUTuKbt8B79WjD3NgV3mU8Kk=; b=i0H7mzgzue1XMZdTWSjbmS5OTj092764/40jzz76OwZj/dFhs47nh8qvumJkJ40Dn7 jtfVT0xTlIrK28UokONsXVewah6+M6l12Yssk2U93+A7My9LZANBY2kqTP0tF8VXSeFz oziXqrlRx9+21VM9adl1NXKNC7orax68lNRQtM2B9PcoqtgjvdpYNQ4D+DA6zQl+BZgu UUR8HJkoDDW3OlRrqchf/o4+adEg8aAOrtZvpOXZ4QJGFrc1Yg9wlaPOy0gJQoxykTJd RL4kAu5JSU3p5oVcXSQB8suFTxcYUYB1Eo+gkQWX2g0pwgJTS8nUWdNKHdRPokJy3FLo Rq0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si12186281edd.347.2021.05.31.07.55.41; Mon, 31 May 2021 07:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233734AbhEaO5N (ORCPT + 17 others); Mon, 31 May 2021 10:57:13 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:3356 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234294AbhEaOyy (ORCPT ); Mon, 31 May 2021 10:54:54 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4FtyqX5ffTz66Ql; Mon, 31 May 2021 22:49:28 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 31 May 2021 22:53:11 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 31 May 2021 22:53:10 +0800 From: Zhen Lei To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , Johannes Thumshirn , Ralf Baechle , Dinh Nguyen , Jan Luebbe , Andre Przywara , Channagoud Kadabi , "Venkata Narendra Kumar Gutta" , Andy Gross , Bjorn Andersson , "Khuong Dinh" , York Sun , linux-edac , linux-mips , linux-arm-msm , linux-kernel CC: Zhen Lei Subject: [PATCH v2 1/3] edac: Fix error return code when edac_pci_add_device() fails Date: Mon, 31 May 2021 22:53:00 +0800 Message-ID: <20210531145302.9655-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210531145302.9655-1-thunder.leizhen@huawei.com> References: <20210531145302.9655-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When edac_pci_add_device() fails, fix to return -ENODEV from the error handling case instead of 0. The "goto err" in octeon_pci_probe() is removed to simplify code. Signed-off-by: Zhen Lei --- drivers/edac/amd8111_edac.c | 1 + drivers/edac/mpc85xx_edac.c | 1 + drivers/edac/octeon_edac-pci.c | 9 ++------- 3 files changed, 4 insertions(+), 7 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/edac/amd8111_edac.c b/drivers/edac/amd8111_edac.c index 7508aa416ddbd7b..16b28da6489177a 100644 --- a/drivers/edac/amd8111_edac.c +++ b/drivers/edac/amd8111_edac.c @@ -480,6 +480,7 @@ static int amd8111_pci_probe(struct pci_dev *dev, if (edac_pci_add_device(pci_info->edac_dev, pci_info->edac_idx) > 0) { printk(KERN_ERR "failed to add edac_pci for %s\n", pci_info->ctl_name); + ret = -ENODEV; goto err_edac_free_ctl; } diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 67f7bc3fe5b3b62..312de75e66b851e 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c @@ -248,6 +248,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op) if (edac_pci_add_device(pci, pdata->edac_idx) > 0) { edac_dbg(3, "failed edac_pci_add_device()\n"); + res = -ENODEV; goto err; } diff --git a/drivers/edac/octeon_edac-pci.c b/drivers/edac/octeon_edac-pci.c index 28b238eecefcc9d..07995de4ea703ee 100644 --- a/drivers/edac/octeon_edac-pci.c +++ b/drivers/edac/octeon_edac-pci.c @@ -60,7 +60,6 @@ static void octeon_pci_poll(struct edac_pci_ctl_info *pci) static int octeon_pci_probe(struct platform_device *pdev) { struct edac_pci_ctl_info *pci; - int res = 0; pci = edac_pci_alloc_ctl_info(0, "octeon_pci_err"); if (!pci) @@ -76,15 +75,11 @@ static int octeon_pci_probe(struct platform_device *pdev) if (edac_pci_add_device(pci, 0) > 0) { pr_err("%s: edac_pci_add_device() failed\n", __func__); - goto err; + edac_pci_free_ctl_info(pci); + return -ENODEV; } return 0; - -err: - edac_pci_free_ctl_info(pci); - - return res; } static int octeon_pci_remove(struct platform_device *pdev)