linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Kamlakant Patel <kamlakant.patel@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] gpio: ge: fix error code in gef_gpio_probe()
Date: Wed, 28 Jan 2015 22:13:20 +0300	[thread overview]
Message-ID: <20150128191320.GB10259@mwanda> (raw)

If kstrdup() fails then we should return -ENOMEM but instead the current
code returns success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index 6ea9303..07e9b39 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -77,8 +77,10 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
 
 	/* Setup pointers to chip functions */
 	bgc->gc.label = kstrdup(pdev->dev.of_node->full_name, GFP_KERNEL);
-	if (!bgc->gc.label)
+	if (!bgc->gc.label) {
+		ret = -ENOMEM;
 		goto err0;
+	}
 
 	bgc->gc.base = -1;
 	bgc->gc.ngpio = (u16)(uintptr_t)of_id->data;

             reply	other threads:[~2015-01-28 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28 19:13 Dan Carpenter [this message]
2015-02-09  5:29 ` [patch] gpio: ge: fix error code in gef_gpio_probe() Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150128191320.GB10259@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=gnurou@gmail.com \
    --cc=kamlakant.patel@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).