mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.m@jp.panasonic.com>
To: barebox@lists.infradead.org
Subject: [PATCH] param: add error check to dev_param_set_generic()
Date: Thu, 29 Jan 2015 11:42:13 +0900	[thread overview]
Message-ID: <1422499334-31394-1-git-send-email-yamada.m@jp.panasonic.com> (raw)

The function dev_param_set_generic() may fail because of
out of memory.  If so, return -ENOMEM.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 lib/parameter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/parameter.c b/lib/parameter.c
index d337ef3..71262c4 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -114,7 +114,7 @@ int dev_param_set_generic(struct device_d *dev, struct param_d *p,
 		return 0;
 	}
 	p->value = strdup(val);
-	return 0;
+	return p->value ? 0 : -ENOMEM;
 }
 
 static const char *param_get_generic(struct device_d *dev, struct param_d *p)
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2015-01-29  2:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  2:42 Masahiro Yamada [this message]
2015-01-29  8:55 ` Sascha Hauer

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=1422499334-31394-1-git-send-email-yamada.m@jp.panasonic.com \
    --to=yamada.m@jp.panasonic.com \
    --cc=barebox@lists.infradead.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