Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1397125
| From | Rob Herring <robherring2@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/4] of: changesets: Introduce changeset helper methods |
| Date | 2016-05-09 17:10 +0200 |
| Message-ID | <rwUYN-87h-3@gated-at.bofh.it> (permalink) |
| References | <rwTq2-6rS-9@gated-at.bofh.it> <rwTq3-6rS-33@gated-at.bofh.it> <rwUm6-7na-13@gated-at.bofh.it> <rwUvM-7tx-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, May 9, 2016 at 9:34 AM, Pantelis Antoniou <pantelis.antoniou@konsulko.com> wrote: > Hi Rob, > >> On May 9, 2016, at 17:27 , Rob Herring <robherring2@gmail.com> wrote: >> >> On Mon, May 9, 2016 at 8:20 AM, Pantelis Antoniou >> <pantelis.antoniou@konsulko.com> wrote: >>> Changesets are very powerful, but the lack of a helper API >>> makes using them cumbersome. Introduce a simple copy based >>> API that makes things considerably easier. [...] >>> + /* >>> + * NOTE: There is no check for zero length value. >>> + * In case of a boolean property, this will allocate a value >>> + * of zero bytes. We do this to work around the use >>> + * of of_get_property() calls on boolean values. >>> + */ >>> + new_value = kmemdup(value, length, GFP_KERNEL); >>> + if (!new_value) >>> + goto out_no_value; >>> + >>> + of_property_set_flag(prop, OF_DYNAMIC); >>> + >>> + prop->name = new_name; >>> + prop->value = new_value; >>> + prop->length = length; >>> + >>> + if (!update) >>> + ret = of_changeset_add_property(ocs, np, prop); >>> + else >>> + ret = of_changeset_update_property(ocs, np, prop); >>> + >>> + if (ret != 0) >> >> if (!ret) >> return 0; >> >> > >>> + goto out_no_add; >>> + >>> + return 0; >>> + >>> +out_no_add: >> >> ... and remove all this. >> > > Err, there’s an exit path here from kmemdup (goto err_no_value). > We’ll be leaking memory on error. No you won't. "This" is the hunk above it. The error handling would still be here: >>> + kfree(prop->value); >>> +out_no_value: >>> + kfree(prop->name); >>> +out_no_name: >>> + kfree(prop); >>> +out_no_prop: >>> + return ret; >>> +}
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/4] of: dynamic: Changesets helpers & fixes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-05-09 15:30 +0200
[PATCH 1/4] of: dynamic: changeset prop-update revert fix Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-05-09 15:30 +0200
[PATCH 3/4] of: changesets: Introduce changeset helper methods Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-05-09 15:30 +0200
Re: [PATCH 3/4] of: changesets: Introduce changeset helper methods Rob Herring <robherring2@gmail.com> - 2016-05-09 16:30 +0200
Re: [PATCH 3/4] of: changesets: Introduce changeset helper methods Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-05-09 16:40 +0200
Re: [PATCH 3/4] of: changesets: Introduce changeset helper methods Rob Herring <robherring2@gmail.com> - 2016-05-09 17:10 +0200
csiph-web