From patchwork Wed Jan 26 20:03:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12725704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2DDDC6369B for ; Wed, 26 Jan 2022 20:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229712AbiAZUEB (ORCPT ); Wed, 26 Jan 2022 15:04:01 -0500 Received: from mxout04.lancloud.ru ([45.84.86.114]:35046 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiAZUD7 (ORCPT ); Wed, 26 Jan 2022 15:03:59 -0500 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 1159120ACBF1 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , CC: Dinh Nguyen Subject: [PATCH 1/5] edac: altera: add IRQ checks for L2 cache and OCRAM Date: Wed, 26 Jan 2022 23:03:49 +0300 Message-ID: <20220126200353.14582-2-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220126200353.14582-1-s.shtylyov@omp.ru> References: <20220126200353.14582-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The driver neglects to check the result of platform_get_irq()'s calls and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the original error. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: c3eea1942a16 ("EDAC, altera: Add Altera L2 cache and OCRAM support") Signed-off-by: Sergey Shtylyov --- drivers/edac/altera_edac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index 3a6d2416cb0f..3b6a2650cf5b 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -776,6 +776,10 @@ static int altr_edac_device_probe(struct platform_device *pdev) } drvdata->sb_irq = platform_get_irq(pdev, 0); + if (drvdata->sb_irq < 0) { + res = drvdata->sb_irq; + goto fail1; + } res = devm_request_irq(&pdev->dev, drvdata->sb_irq, altr_edac_device_handler, 0, dev_name(&pdev->dev), dci); @@ -783,6 +787,10 @@ static int altr_edac_device_probe(struct platform_device *pdev) goto fail1; drvdata->db_irq = platform_get_irq(pdev, 1); + if (drvdata->db_irq < 0) { + res = drvdata->db_irq; + goto fail1; + } res = devm_request_irq(&pdev->dev, drvdata->db_irq, altr_edac_device_handler, 0, dev_name(&pdev->dev), dci); From patchwork Wed Jan 26 20:03:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12725703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 775F1C5DF62 for ; Wed, 26 Jan 2022 20:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbiAZUD7 (ORCPT ); Wed, 26 Jan 2022 15:03:59 -0500 Received: from mxout02.lancloud.ru ([45.84.86.82]:33944 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbiAZUD7 (ORCPT ); Wed, 26 Jan 2022 15:03:59 -0500 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 9798D2078F66 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , CC: Dinh Nguyen Subject: [PATCH 2/5] edac: altera: add IRQ check for Arria10 Date: Wed, 26 Jan 2022 23:03:50 +0300 Message-ID: <20220126200353.14582-3-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220126200353.14582-1-s.shtylyov@omp.ru> References: <20220126200353.14582-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the original error. Stop calling devm_request_irq() with the invalid IRQ #s. While at it, move the call to platform_get_irq() to the place where it makes more sense... Fixes: 73bcc942f427 ("EDAC, altera: Add Arria10 EDAC support") Signed-off-by: Sergey Shtylyov --- drivers/edac/altera_edac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index 3b6a2650cf5b..21b5d2fac9be 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -353,9 +353,6 @@ static int altr_sdram_probe(struct platform_device *pdev) return -ENODEV; } - /* Arria10 has a 2nd IRQ */ - irq2 = platform_get_irq(pdev, 1); - layers[0].type = EDAC_MC_LAYER_CHIP_SELECT; layers[0].size = 1; layers[0].is_virt_csrow = true; @@ -406,6 +403,12 @@ static int altr_sdram_probe(struct platform_device *pdev) if (res < 0) goto err2; + /* Arria10 has a 2nd IRQ */ + irq2 = platform_get_irq(pdev, 1); + if (irq2 < 0) { + res = irq2; + goto err2; + } res = devm_request_irq(&pdev->dev, irq2, altr_sdram_mc_err_handler, IRQF_SHARED, dev_name(&pdev->dev), mci); From patchwork Wed Jan 26 20:03:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12725705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D89BC636C8 for ; Wed, 26 Jan 2022 20:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbiAZUEA (ORCPT ); Wed, 26 Jan 2022 15:04:00 -0500 Received: from mxout03.lancloud.ru ([45.84.86.113]:53862 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbiAZUD7 (ORCPT ); Wed, 26 Jan 2022 15:03:59 -0500 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 227AE20763EF Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , CC: York Sun Subject: [PATCH 3/5] edac: fsl_ddr: add IRQ check Date: Wed, 26 Jan 2022 23:03:51 +0300 Message-ID: <20220126200353.14582-4-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220126200353.14582-1-s.shtylyov@omp.ru> References: <20220126200353.14582-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the original error. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 55764ed37eec ("EDAC, fsl_ddr: Fix IRQ dispose warning when module is removed") Signed-off-by: Sergey Shtylyov --- drivers/edac/fsl_ddr_edac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index 6d8ea226010d..64f1108726b0 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -586,6 +586,10 @@ int fsl_mc_err_probe(struct platform_device *op) /* register interrupts */ pdata->irq = platform_get_irq(op, 0); + if (pdata->irq < 0) { + res = pdata->irq; + goto err2; + } res = devm_request_irq(&op->dev, pdata->irq, fsl_mc_isr, IRQF_SHARED, From patchwork Wed Jan 26 20:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12725702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16B63C63684 for ; Wed, 26 Jan 2022 20:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbiAZUEA (ORCPT ); Wed, 26 Jan 2022 15:04:00 -0500 Received: from mxout01.lancloud.ru ([45.84.86.81]:37092 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbiAZUEA (ORCPT ); Wed, 26 Jan 2022 15:04:00 -0500 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru A0780209BFBD Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , CC: Andre Przywara Subject: [PATCH 4/5] edac: highbank_l2: add IRQ checks Date: Wed, 26 Jan 2022 23:03:52 +0300 Message-ID: <20220126200353.14582-5-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220126200353.14582-1-s.shtylyov@omp.ru> References: <20220126200353.14582-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The driver neglects to check the result of platform_get_irq()'s calls and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the original error. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 69154d069869 ("edac: add support for Calxeda highbank L2 cache ecc") Signed-off-by: Sergey Shtylyov --- drivers/edac/highbank_l2_edac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/edac/highbank_l2_edac.c b/drivers/edac/highbank_l2_edac.c index c4549cec788b..e58c84f8e624 100644 --- a/drivers/edac/highbank_l2_edac.c +++ b/drivers/edac/highbank_l2_edac.c @@ -94,6 +94,10 @@ static int highbank_l2_err_probe(struct platform_device *pdev) goto err; drvdata->db_irq = platform_get_irq(pdev, 0); + if (drvdata->db_irq < 0) { + res = drvdata->db_irq; + goto err2; + } res = devm_request_irq(&pdev->dev, drvdata->db_irq, highbank_l2_err_handler, 0, dev_name(&pdev->dev), dci); @@ -101,6 +105,10 @@ static int highbank_l2_err_probe(struct platform_device *pdev) goto err2; drvdata->sb_irq = platform_get_irq(pdev, 1); + if (drvdata->sb_irq < 0) { + res = drvdata->sb_irq; + goto err2; + } res = devm_request_irq(&pdev->dev, drvdata->sb_irq, highbank_l2_err_handler, 0, dev_name(&pdev->dev), dci); From patchwork Wed Jan 26 20:03:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12725706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C338FC636CF for ; Wed, 26 Jan 2022 20:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbiAZUEB (ORCPT ); Wed, 26 Jan 2022 15:04:01 -0500 Received: from mxout04.lancloud.ru ([45.84.86.114]:35066 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiAZUEA (ORCPT ); Wed, 26 Jan 2022 15:04:00 -0500 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 2DDBA20ACBE3 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , CC: Andre Przywara Subject: [PATCH 5/5] edac: highbank_mc: add IRQ check Date: Wed, 26 Jan 2022 23:03:53 +0300 Message-ID: <20220126200353.14582-6-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220126200353.14582-1-s.shtylyov@omp.ru> References: <20220126200353.14582-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the original error. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: a1b01edb2745 ("edac: add support for Calxeda highbank memory controller") Signed-off-by: Sergey Shtylyov --- drivers/edac/highbank_mc_edac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c index 61b76ec226af..36931cafcab0 100644 --- a/drivers/edac/highbank_mc_edac.c +++ b/drivers/edac/highbank_mc_edac.c @@ -230,6 +230,10 @@ static int highbank_mc_probe(struct platform_device *pdev) goto err; irq = platform_get_irq(pdev, 0); + if (irq < 0) { + res = irq; + goto err; + } res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, 0, dev_name(&pdev->dev), mci); if (res < 0) {