[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180603201617.15805-1-robert.jarzmik@free.fr>
Date: Sun, 3 Jun 2018 22:16:17 +0200
From: Robert Jarzmik <robert.jarzmik@...e.fr>
To: Lee Jones <lee.jones@...aro.org>
Cc: patches@...nsource.cirrus.com, linux-kernel@...r.kernel.org,
Robert Jarzmik <robert.jarzmik@...e.fr>
Subject: [PATCH] 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@...e.fr>
---
drivers/mfd/wm97xx-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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:
--
2.11.0
Powered by blists - more mailing lists