From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] of: base: of_new_property(): use xstrdup() instead of strdup()
Date: Wed, 19 Apr 2017 12:19:28 +0200 [thread overview]
Message-ID: <20170419101928.5khm52lba5o4bj6s@pengutronix.de> (raw)
In-Reply-To: <20170419132026.5ac56ed0b7fc52b8ad61477d@gmail.com>
On Wed, Apr 19, 2017 at 01:20:26PM +0300, Antony Pavlov wrote:
> On Mon, 17 Apr 2017 13:42:10 +0300
> Antony Pavlov <antonynpavlov@gmail.com> wrote:
>
> > At the moment of_new_property() uses xfunctions for memory
> > allocation so we can use xstrdup() instead of strdup()
> > for code simplification.
> >
> > A side effect of this commmit is that
> > the of_new_property() function can't return NULL
> > anymore if CONFIG_OFTREE is set.
>
> If of_new_property() can't return NULL we can skip all numerous
> checks after of_new_property() call. So the checks are actual only
> if CONFIG_OFTREE isn't set.
>
> Have you any sugestions on removing of_new_property() return value checks?
I'm not sure removing these checks is a good idea. One possible error
return for of_new_property() could be -EEXIST. Right now we do not check
is the property already exists and just create a second property with
the same name. Also if you consider FIT images: These store a whole
kernel in a device tree property, so the xmalloc() we have for
allocating the data for the property might better be malloc() so that
it can fail.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-04-19 10:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 10:42 [PATCH 0/2] of: base: some simplifications Antony Pavlov
2017-04-17 10:42 ` [PATCH 1/2] of: base: exclude memcpy-like code from of_property_write_u8_array() Antony Pavlov
2017-04-17 10:42 ` [PATCH 2/2] of: base: of_new_property(): use xstrdup() instead of strdup() Antony Pavlov
2017-04-19 10:20 ` Antony Pavlov
2017-04-19 10:19 ` Sascha Hauer [this message]
2017-04-19 9:47 ` [PATCH 0/2] of: base: some simplifications 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=20170419101928.5khm52lba5o4bj6s@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=antonynpavlov@gmail.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