summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm97xx-core.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2018-06-03 22:16:17 +0200
committerLee Jones <lee.jones@linaro.org>2018-06-11 10:11:03 +0200
commit46f107d0cb22b3f2b23d7fc7c50757f453a36508 (patch)
tree2e378e566d07e99fe3f5daceaef9a20df81ba3b0 /drivers/mfd/wm97xx-core.c
parentmfd: cros_ec_dev: Don't advertise junk features on failure (diff)
downloadlinux-46f107d0cb22b3f2b23d7fc7c50757f453a36508.tar.xz
linux-46f107d0cb22b3f2b23d7fc7c50757f453a36508.zip
mfd: wm97xx-core: Platform data can be NULL
It is not mandatory that platform data is passed along the ac97 codec. Actually there are configuration without a battery connected to the ADC of the codec. This is for example the case for the PXA zylonite platform, so fix the NULL dereferencing by adding a test. Fixes: a5c6951c49fb ("mfd: wm97xx-core: core support for wm97xx Codec") Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/wm97xx-core.c')
-rw-r--r--drivers/mfd/wm97xx-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
index 4141ee52a70b..f5a8347f837f 100644
--- a/drivers/mfd/wm97xx-core.c
+++ b/drivers/mfd/wm97xx-core.c
@@ -278,7 +278,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
codec_pdata = &wm97xx->codec_pdata;
codec_pdata->ac97 = wm97xx->ac97;
- codec_pdata->batt_pdata = pdata->batt_pdata;
+ codec_pdata->batt_pdata = pdata ? pdata->batt_pdata : NULL;
switch (adev->vendor_id) {
case WM9705_VENDOR_ID: