lkml.org 
[lkml]   [2018]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] altera_edac: Use common error handling code in altr_sdram_probe()
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 12 Mar 2018 16:23:53 +0100

Add a jump target so that a specific error code is assigned to the
local variable "res" at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/edac/altera_edac.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 11d6419788c2..d5c15b27d520 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -419,8 +419,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
if (res < 0) {
edac_mc_printk(mci, KERN_ERR,
"Unable to request irq %d\n", irq2);
- res = -ENODEV;
- goto err2;
+ goto e_nodev;
}

res = a10_unmask_irq(pdev, A10_DDR0_IRQ_MASK);
@@ -435,8 +434,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
if (res < 0) {
edac_mc_printk(mci, KERN_ERR,
"Unable to request irq %d\n", irq);
- res = -ENODEV;
- goto err2;
+ goto e_nodev;
}

/* Infrastructure ready - enable the IRQ */
@@ -444,8 +442,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
priv->ecc_irq_en_mask, priv->ecc_irq_en_mask)) {
edac_mc_printk(mci, KERN_ERR,
"Error enabling SDRAM ECC IRQ\n");
- res = -ENODEV;
- goto err2;
+ goto e_nodev;
}

altr_sdr_mc_create_debugfs_nodes(mci);
@@ -454,6 +451,8 @@ static int altr_sdram_probe(struct platform_device *pdev)

return 0;

+e_nodev:
+ res = -ENODEV;
err2:
edac_mc_del_mc(&pdev->dev);
err:
--
2.16.2
\
 
 \ /
  Last update: 2018-03-12 16:31    [W:0.021 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site