lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d745069-3647-408b-b34c-b29053b121f8@alliedtelesis.co.nz>
Date: Tue, 16 Apr 2024 04:00:02 +0000
From: Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To: Abhinav Jain <jain.abhinav177@...il.com>, "andi.shyti@...nel.org"
	<andi.shyti@...nel.org>, "linux-i2c@...r.kernel.org"
	<linux-i2c@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
CC: "skhan@...uxfoundation.org" <skhan@...uxfoundation.org>,
	"javier.carrasco.cruz@...il.com" <javier.carrasco.cruz@...il.com>, "Julia
 Lawall" <julia.lawall@...ia.fr>
Subject: Re: [PATCH] i2c: mpc: Removal of of_node_put with __free for auto
 cleanup


On 16/04/24 04:12, Abhinav Jain wrote:
> Remove of_node_put from node_ctrl and node struct device_nodes.
> Move the declaration to initialization for ensuring scope sanity.
>
> Suggested-by: Julia Lawall <julia.lawall@...ia.fr>
> Signed-off-by: Abhinav Jain <jain.abhinav177@...il.com>

Reviewed-by: Chris Packham <chris.packham@...iedtelesis.co.nz>

> ---
>   drivers/i2c/busses/i2c-mpc.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 8d73c0f405ed..c4223556b3b8 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -304,13 +304,12 @@ static void mpc_i2c_setup_512x(struct device_node *node,
>   					 struct mpc_i2c *i2c,
>   					 u32 clock)
>   {
> -	struct device_node *node_ctrl;
>   	void __iomem *ctrl;
>   	u32 idx;
>   
>   	/* Enable I2C interrupts for mpc5121 */
> -	node_ctrl = of_find_compatible_node(NULL, NULL,
> -					    "fsl,mpc5121-i2c-ctrl");
> +	struct device_node *node_ctrl __free(device_node) =
> +		of_find_compatible_node(NULL, NULL, "fsl,mpc5121-i2c-ctrl");
>   	if (node_ctrl) {
>   		ctrl = of_iomap(node_ctrl, 0);
>   		if (ctrl) {
> @@ -321,7 +320,6 @@ static void mpc_i2c_setup_512x(struct device_node *node,
>   			setbits32(ctrl, 1 << (24 + idx * 2));
>   			iounmap(ctrl);
>   		}
> -		of_node_put(node_ctrl);
>   	}
>   
>   	/* The clock setup for the 52xx works also fine for the 512x */
> @@ -358,11 +356,11 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
>   
>   static u32 mpc_i2c_get_sec_cfg_8xxx(void)
>   {
> -	struct device_node *node;
>   	u32 __iomem *reg;
>   	u32 val = 0;
>   
> -	node = of_find_node_by_name(NULL, "global-utilities");
> +	struct device_node *node __free(device_node) =
> +		of_find_node_by_name(NULL, "global-utilities");
>   	if (node) {
>   		const u32 *prop = of_get_property(node, "reg", NULL);
>   		if (prop) {
> @@ -383,7 +381,6 @@ static u32 mpc_i2c_get_sec_cfg_8xxx(void)
>   			iounmap(reg);
>   		}
>   	}
> -	of_node_put(node);
>   
>   	return val;
>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ