Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: wm831x: Fix possible NULL pointer dereference

The driver always checks for pdata being NULL except in one place.
Add a check to prevent a possible NULL pointer deference error.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Javier Martinez Canillas and committed by
Lee Jones
16dfd103 d785334a

+3 -1
+3 -1
drivers/mfd/wm831x-core.c
··· 1626 1626 mutex_init(&wm831x->io_lock); 1627 1627 mutex_init(&wm831x->key_lock); 1628 1628 dev_set_drvdata(wm831x->dev, wm831x); 1629 - wm831x->soft_shutdown = pdata->soft_shutdown; 1629 + 1630 + if (pdata) 1631 + wm831x->soft_shutdown = pdata->soft_shutdown; 1630 1632 1631 1633 ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); 1632 1634 if (ret < 0) {