fbdev: offb: replace of_node_put with __free(device_node)
authorAbdulrasaq Lawani <abdulrasaqolawani@gmail.com>
Tue, 23 Apr 2024 01:20:21 +0000 (21:20 -0400)
committerHelge Deller <deller@gmx.de>
Thu, 25 Apr 2024 10:13:06 +0000 (12:13 +0200)
Replaced instance of of_node_put with __free(device_node)
to simplify code and protect against any memory leaks
due to future changes in the control flow.

Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Abdulrasaq Lawani <abdulrasaqolawani@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/offb.c

index b421b46d88efcad3cd6a623cc049573f6ccd8f35..ea38a260774bf5676a0e03b46361fd900ffe9903 100644 (file)
@@ -357,7 +357,7 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp
                        par->cmap_type = cmap_gxt2000;
        } else if (of_node_name_prefix(dp, "vga,Display-")) {
                /* Look for AVIVO initialized by SLOF */
-               struct device_node *pciparent = of_get_parent(dp);
+               struct device_node *pciparent __free(device_node) = of_get_parent(dp);
                const u32 *vid, *did;
                vid = of_get_property(pciparent, "vendor-id", NULL);
                did = of_get_property(pciparent, "device-id", NULL);
@@ -369,7 +369,6 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp
                        if (par->cmap_adr)
                                par->cmap_type = cmap_avivo;
                }
-               of_node_put(pciparent);
        } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) {
 #ifdef __BIG_ENDIAN
                const __be32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 };