[PATCH][next] drivers: video: Simplify device_node cleanup using __free

Daniel Thompson daniel.thompson at linaro.org
Fri Apr 19 11:16:13 UTC 2024


^^^

Please fix the subject line to be "backlight: <driver>: ...". I came
very close to deleting this patch without reading it ;-) .


On Fri, Apr 19, 2024 at 01:13:02AM +0530, Shresth Prasad wrote:
> diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c
> index eb18c6eb0ff0..3c5d8125080c 100644
> --- a/drivers/video/backlight/sky81452-backlight.c
> +++ b/drivers/video/backlight/sky81452-backlight.c
> @@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = {
>  static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
>  							struct device *dev)
>  {
> -	struct device_node *np = of_node_get(dev->of_node);
> +	struct device_node *np __free(device_node) = of_node_get(dev->of_node);


Do we need to get dev->of_node at all? The device, which we are
borrowing, already owns a reference to the node so I don't see
any point in this function taking an extra one.

So why not simply make this:

	struct device_node *np = dev->of_node;


Daniel.


More information about the dri-devel mailing list