diff options
author | Javier Martinez Canillas <javier@osg.samsung.com> | 2015-09-14 11:07:56 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-10-26 15:49:04 +0100 |
commit | 16dfd10375011e0999ce9d96df2df08380edf001 (patch) | |
tree | dae9716e71be06d3f9e622d741c6bd0bb324877f /drivers/mfd | |
parent | mfd: s2mps11: Add manual shutdown method for Odroid XU3 (diff) | |
download | linux-16dfd10375011e0999ce9d96df2df08380edf001.tar.xz linux-16dfd10375011e0999ce9d96df2df08380edf001.zip |
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/wm831x-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) { |