Commit 16dfd103 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Lee Jones

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: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent d785334a
...@@ -1626,6 +1626,8 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) ...@@ -1626,6 +1626,8 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
mutex_init(&wm831x->io_lock); mutex_init(&wm831x->io_lock);
mutex_init(&wm831x->key_lock); mutex_init(&wm831x->key_lock);
dev_set_drvdata(wm831x->dev, wm831x); dev_set_drvdata(wm831x->dev, wm831x);
if (pdata)
wm831x->soft_shutdown = pdata->soft_shutdown; wm831x->soft_shutdown = pdata->soft_shutdown;
ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment