From: Javier Martinez Canillas Date: Mon, 14 Sep 2015 09:07:56 +0000 (+0200) Subject: mfd: wm831x: Fix possible NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16dfd10375011e0999ce9d96df2df08380edf001;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Acked-by: Charles Keepax Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 28366a90e1ad..3e0e99ec5836 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -1626,7 +1626,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) mutex_init(&wm831x->io_lock); mutex_init(&wm831x->key_lock); dev_set_drvdata(wm831x->dev, wm831x); - wm831x->soft_shutdown = pdata->soft_shutdown; + + if (pdata) + wm831x->soft_shutdown = pdata->soft_shutdown; ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); if (ret < 0) {