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>
omapfb_conf = dev_get_platdata(fbdev->dev);
hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
+ if (IS_ERR(hwa742.sys_ck))
+ return PTR_ERR(hwa742.sys_ck);
spin_lock_init(&hwa742.req_lock);
err2:
hwa742.int_ctrl->cleanup();
err1:
+ clk_put(hwa742.sys_ck);
return r;
}
hwa742.extif->cleanup();
hwa742.int_ctrl->cleanup();
clk_disable_unprepare(hwa742.sys_ck);
+ clk_put(hwa742.sys_ck);
}
struct lcd_ctrl hwa742_ctrl = {