summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorHarry Hong <hhong@nvidia.com>2014-01-06 14:54:53 +0900
committerHarry Hong <hhong@nvidia.com>2014-01-06 02:07:22 -0800
commitb909fcf5d8ca54477fb18cccc7c462d2931c4bdf (patch)
tree7d846f7a515d7cf8950807d350a6bc33f5f4a6ee /sound
parente687b9cc3671c3dfe4f9dfaead536ba47d9bf551 (diff)
asoc: rt5639: fix null pointer expection.
if codec structure doesn't have hw_read(), skip calling it in rt5639_codec_show. Bug 1433596 Bug 1434588 Change-Id: I4e7d33d8f01e54b476e1b084a256f2b525a9b23f Signed-off-by: Harry Hong <hhong@nvidia.com> Reviewed-on: http://git-master/r/352132
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5639.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/soc/codecs/rt5639.c b/sound/soc/codecs/rt5639.c
index 97fbd9749c34..e46a16088df2 100644
--- a/sound/soc/codecs/rt5639.c
+++ b/sound/soc/codecs/rt5639.c
@@ -4,7 +4,7 @@
* Copyright (c) 2011-2013 REALTEK SEMICONDUCTOR CORP. All rights reserved.
* Author: Johnny Hsu <johnnyhsu@realtek.com>
*
- * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -2771,7 +2771,10 @@ static ssize_t rt5639_codec_show(struct device *dev,
for (i = 0; i <= RT5639_VENDOR_ID2; i++) {
if (cnt + RT5639_REG_DISP_LEN >= PAGE_SIZE)
break;
- val = codec->hw_read(codec, i);
+ if (codec->hw_read)
+ val = codec->hw_read(codec, i);
+ else
+ break;
if (!val)
continue;
cnt += snprintf(buf + cnt, RT5639_REG_DISP_LEN,
@@ -2819,9 +2822,12 @@ static ssize_t rt5639_codec_store(struct device *dev,
if (addr > RT5639_VENDOR_ID2 || val > 0xffff || val < 0)
return count;
- if (i == count)
- dev_info(codec->dev, "0x%02x = 0x%04x\n", addr,
- codec->hw_read(codec, addr));
+ if (i == count) {
+ if (codec->hw_read) {
+ dev_info(codec->dev, "0x%02x = 0x%04x\n", addr,
+ codec->hw_read(codec, addr));
+ }
+ }
else
snd_soc_write(codec, addr, val);