Re: [PATCH] drm/tegra: rgb: Simplify tegra_dc_rgb_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

Thanks for your patch!

On Sat, 1 Feb 2025 at 11:57, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> Simplify tegra_dc_rgb_probe() by using of_get_available_child_by_name().

That's not the only thing this patch does...

>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

> --- a/drivers/gpu/drm/tegra/rgb.c
> +++ b/drivers/gpu/drm/tegra/rgb.c
> @@ -202,12 +202,12 @@ static const struct drm_encoder_helper_funcs tegra_rgb_encoder_helper_funcs = {
>
>  int tegra_dc_rgb_probe(struct tegra_dc *dc)
>  {
> -       struct device_node *np;
> +       struct device_node *np _free(device_node) =

Adding the _free()...

> +               of_get_available_child_by_name(dc->dev->of_node, "rgb");
>         struct tegra_rgb *rgb;
>         int err;
>
> -       np = of_get_child_by_name(dc->dev->of_node, "rgb");
> -       if (!np || !of_device_is_available(np))
> +       if (!np)
>                 return -ENODEV;

... fixes the reference count in case of an unavailable node...

>
>         rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);

... but as np is stored below, it must not be freed when it goes out
of context?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux