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.

fbdev: omapfb: Add missing error check for clk_get()

The hwa742_init() function did not check the return value of clk_get().
This could lead to dereferencing an error pointer in subsequent clock
operations, potentially causing a kernel crash.

Fix this by adding a missing error check and ensuring proper clock
resource cleanup on failure and driver removal.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Chen Ni and committed by
Helge Deller
d3da7f00 f0447880

+4
+4
drivers/video/fbdev/omap/hwa742.c
··· 950 950 omapfb_conf = dev_get_platdata(fbdev->dev); 951 951 952 952 hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck"); 953 + if (IS_ERR(hwa742.sys_ck)) 954 + return PTR_ERR(hwa742.sys_ck); 953 955 954 956 spin_lock_init(&hwa742.req_lock); 955 957 ··· 1030 1028 err2: 1031 1029 hwa742.int_ctrl->cleanup(); 1032 1030 err1: 1031 + clk_put(hwa742.sys_ck); 1033 1032 return r; 1034 1033 } 1035 1034 ··· 1040 1037 hwa742.extif->cleanup(); 1041 1038 hwa742.int_ctrl->cleanup(); 1042 1039 clk_disable_unprepare(hwa742.sys_ck); 1040 + clk_put(hwa742.sys_ck); 1043 1041 } 1044 1042 1045 1043 struct lcd_ctrl hwa742_ctrl = {