pinctrl: baytrail: Fix potential NULL pointer dereference
saved-context in byt_gpio_probe is allocated via devm_kcalloc and is used without checking for NULL in later functions. This patch avoids such a scenario. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
9e98c678c2
commit
d6cb77228e
|
@ -1710,6 +1710,8 @@ static int byt_gpio_probe(struct byt_gpio *vg)
|
|||
#ifdef CONFIG_PM_SLEEP
|
||||
vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
|
||||
sizeof(*vg->saved_context), GFP_KERNEL);
|
||||
if (!vg->saved_context)
|
||||
return -ENOMEM;
|
||||
#endif
|
||||
ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in New Issue