From: David Gibson <david@gibson.dropbear.id.au>
To: Tadeusz Struk <tadeusz.struk@linaro.org>
Cc: Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH 1/2] libfdt: add fdt_get_property_by_offset_w helper
Date: Tue, 11 Oct 2022 12:52:48 +1100 [thread overview]
Message-ID: <Y0TMcMher9fEfCYX@yekko> (raw)
In-Reply-To: <20221007191116.161426-1-tadeusz.struk@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]
On Fri, Oct 07, 2022 at 12:11:15PM -0700, Tadeusz Struk wrote:
> Add a new fdt_get_property_by_offset_w helper function.
> It is a wrapper on the fdt_get_property_by_offset() cuntion
> that returns a writable pointer to a property at a given offset.
>
> Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Sorty for the delay. There's one nit here:
> ---
> libfdt/libfdt.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
> index a7f432c..cddc2d6 100644
> --- a/libfdt/libfdt.h
> +++ b/libfdt/libfdt.h
> @@ -660,6 +660,13 @@ int fdt_next_property_offset(const void *fdt, int offset);
> const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
> int offset,
> int *lenp);
> +static inline struct fdt_property *fdt_get_property_by_offset_w(const void *fdt,
This should be void *fdt, not const void *fdt: the function shouldn't
let you get a writable pointer into the fdt if you didn't have a
writable pointer to the fdt to begin with.
> + int offset,
> + int *lenp)
> +{
> + return (struct fdt_property *)(uintptr_t)
> + fdt_get_property_by_offset(fdt, offset, lenp);
> +}
>
> /**
> * fdt_get_property_namelen - find a property based on substring
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-10-11 2:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 19:11 [PATCH 1/2] libfdt: add fdt_get_property_by_offset_w helper Tadeusz Struk
2022-10-07 19:11 ` [PATCH v5 2/2] libfdt: tests: add get_next_tag_invalid_prop_len Tadeusz Struk
2022-10-11 2:06 ` David Gibson
2022-10-11 1:52 ` David Gibson [this message]
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=Y0TMcMher9fEfCYX@yekko \
--to=david@gibson.dropbear.id.au \
--cc=devicetree-compiler@vger.kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tadeusz.struk@linaro.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).