MLK-12215 video: mxsfb: free the 'timings' after using it to avoid resource leak
authorFancy Fang <chen.fang@nxp.com>
Tue, 12 Jan 2016 09:29:19 +0000 (17:29 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:46 +0000 (14:49 -0500)
The 'timings' is allocated by 'of_get_display_timings()'
dynamically. So it should be freed when it is not used
anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
drivers/video/fbdev/mxsfb.c

index 329a569..d8c6885 100644 (file)
@@ -1108,7 +1108,7 @@ static int mxsfb_init_fbinfo_dt(struct mxsfb_info *host)
        struct device_node *np = host->pdev->dev.of_node;
        struct device_node *display_np;
        struct device_node *timings_np;
-       struct display_timings *timings;
+       struct display_timings *timings = NULL;
        const char *disp_dev;
        u32 width;
        int i;
@@ -1197,6 +1197,8 @@ static int mxsfb_init_fbinfo_dt(struct mxsfb_info *host)
 put_timings_node:
        of_node_put(timings_np);
 put_display_node:
+       if (timings)
+               kfree(timings);
        of_node_put(display_np);
        return ret;
 }