Skip to content

Commit

Permalink
mfd: wm97xx-core: Platform data can be NULL
Browse files Browse the repository at this point in the history
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: a5c6951 ("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>
  • Loading branch information
rjarzmik authored and Lee Jones committed Jun 11, 2018
1 parent df7c3bf commit 46f107d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mfd/wm97xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 46f107d

Please sign in to comment.