Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbdHPFFP (ORCPT ); Wed, 16 Aug 2017 01:05:15 -0400 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:30514 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750827AbdHPFFO (ORCPT ); Wed, 16 Aug 2017 01:05:14 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 16 Aug 2017 07:05:13 +0200 X-ME-IP: 90.21.173.186 From: Christophe JAILLET To: thor.thayer@linux.intel.com, bp@alien8.de, mchehab@kernel.org Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] EDAC, altera: Fix an error handling path in 'altr_edac_device_probe()' Date: Wed, 16 Aug 2017 07:05:06 +0200 Message-Id: <20170816050506.14541-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 863 Lines: 27 'res' is known to be 0 at this point. If 'devm_ioremap()' fails, returns -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/edac/altera_edac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index fa2e5db56d24..346c4987b284 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -747,8 +747,10 @@ static int altr_edac_device_probe(struct platform_device *pdev) drvdata->edac_dev_name = ecc_name; drvdata->base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (!drvdata->base) + if (!drvdata->base) { + res = -ENOMEM; goto fail1; + } /* Get driver specific data for this EDAC device */ drvdata->data = of_match_node(altr_edac_device_of_match, np)->data; -- 2.11.0