Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/tegra: rgb: Fix the unbound reference count

The of_get_child_by_name() increments the refcount in tegra_dc_rgb_probe,
but the driver does not decrement the refcount during unbind. Fix the
unbound reference count using devm_add_action_or_reset() helper.

Fixes: d8f4a9eda006 ("drm: Add NVIDIA Tegra20 support")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20250205112137.36055-1-biju.das.jz@bp.renesas.com

authored by

Biju Das and committed by
Thierry Reding
3c364233 33ca5aaf

+13 -1
+13 -1
drivers/gpu/drm/tegra/rgb.c
··· 200 200 .atomic_check = tegra_rgb_encoder_atomic_check, 201 201 }; 202 202 203 + static void tegra_dc_of_node_put(void *data) 204 + { 205 + of_node_put(data); 206 + } 207 + 203 208 int tegra_dc_rgb_probe(struct tegra_dc *dc) 204 209 { 205 210 struct device_node *np; ··· 212 207 int err; 213 208 214 209 np = of_get_child_by_name(dc->dev->of_node, "rgb"); 215 - if (!np || !of_device_is_available(np)) 210 + if (!np) 211 + return -ENODEV; 212 + 213 + err = devm_add_action_or_reset(dc->dev, tegra_dc_of_node_put, np); 214 + if (err < 0) 215 + return err; 216 + 217 + if (!of_device_is_available(np)) 216 218 return -ENODEV; 217 219 218 220 rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL);