Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6cb7722 authored by Aditya Pakki's avatar Aditya Pakki Committed by Andy Shevchenko
Browse files

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: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 9e98c678
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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) {