[PATCH RESEND v2 06/51] powerpc/pseries: put the node that the ofdt property commands look up
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Nov 5 11:28:58 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] powerpc/pseries: __free(device_node) declared = NULL at top of functions
--
commit 3c337546ce05e068449f95031255af375235286d
Author: Christian Brauner <brauner at kernel.org>
powerpc/pseries: put the node that the ofdt property commands look up
This commit uses __free(device_node) in do_add_property(),
do_remove_property(), and do_update_property() to release the device_node
reference obtained by parse_node() via of_find_node_by_phandle().
> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index 18e3f1a036e35..5a0c9c0b6253f 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -271,8 +271,8 @@ static char *parse_node(char *buf, size_t bufsize, struct device_node **npp)
>
> static int do_add_property(char *buf, size_t bufsize)
> {
> + struct device_node *np __free(device_node) = NULL;
> struct property *prop = NULL;
> - struct device_node *np;
> unsigned char *value;
> char *name, *end;
> int length;
> @@ -296,7 +296,7 @@ static int do_add_property(char *buf, size_t bufsize)
>
> static int do_remove_property(char *buf, size_t bufsize)
> {
> - struct device_node *np;
> + struct device_node *np __free(device_node) = NULL;
> char *tmp;
> buf = parse_node(buf, bufsize, &np);
>
> @@ -315,7 +315,7 @@ static int do_remove_property(char *buf, size_t bufsize)
>
> static int do_update_property(char *buf, size_t bufsize)
> {
> - struct device_node *np;
> + struct device_node *np __free(device_node) = NULL;
[Severity: Low]
This isn't a bug, but in do_add_property(), do_remove_property(), and
do_update_property() in arch/powerpc/platforms/pseries/reconfig.c, np is
declared with __free(device_node) = NULL at the top of each function and
assigned later via parse_node(buf, bufsize, &np), whereas cleanup.h
conventions require defining and initializing __free() variables in a single
statement.
Since parse_node() is a static helper only called by these three functions:
static char *parse_node(char *buf, size_t bufsize, struct device_node **npp)
{
char *handle_str;
phandle handle;
*npp = NULL;
...
*npp = of_find_node_by_phandle(handle);
return buf;
}
could parse_node() return struct device_node * directly (and advance char
**buf) so that struct device_node *np __free(device_node) can be defined and
initialized in one statement in each caller?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-work-procfs-bugfixes-v2-0-021c84d852e0@kernel.org?part=6
More information about the kexec
mailing list