aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-05 12:39:51 -0500
committerMark Brown <broonie@linaro.org>2013-11-06 05:26:18 -0500
commit773392b25ce1e5d99c72fcc227bb53ba358497be (patch)
treeaf67ba62580092f7a0d3703f69f1ec08b0586d26 /sound
parenta922cd7151371f429c7456951b77999c75520955 (diff)
ASoC: tpa6130a2: Use WARN_ON() instead of BUG_ON()
Use WARN_ON() and handle the error cases accordingly. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tpa6130a2.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index c58bee8346ce..348552e1771e 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -55,7 +55,8 @@ static int tpa6130a2_i2c_read(int reg)
55 struct tpa6130a2_data *data; 55 struct tpa6130a2_data *data;
56 int val; 56 int val;
57 57
58 BUG_ON(tpa6130a2_client == NULL); 58 if (WARN_ON(!tpa6130a2_client))
59 return -EINVAL;
59 data = i2c_get_clientdata(tpa6130a2_client); 60 data = i2c_get_clientdata(tpa6130a2_client);
60 61
61 /* If powered off, return the cached value */ 62 /* If powered off, return the cached value */
@@ -77,7 +78,8 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
77 struct tpa6130a2_data *data; 78 struct tpa6130a2_data *data;
78 int val = 0; 79 int val = 0;
79 80
80 BUG_ON(tpa6130a2_client == NULL); 81 if (WARN_ON(!tpa6130a2_client))
82 return -EINVAL;
81 data = i2c_get_clientdata(tpa6130a2_client); 83 data = i2c_get_clientdata(tpa6130a2_client);
82 84
83 if (data->power_state) { 85 if (data->power_state) {
@@ -98,7 +100,8 @@ static u8 tpa6130a2_read(int reg)
98{ 100{
99 struct tpa6130a2_data *data; 101 struct tpa6130a2_data *data;
100 102
101 BUG_ON(tpa6130a2_client == NULL); 103 if (WARN_ON(!tpa6130a2_client))
104 return 0;
102 data = i2c_get_clientdata(tpa6130a2_client); 105 data = i2c_get_clientdata(tpa6130a2_client);
103 106
104 return data->regs[reg]; 107 return data->regs[reg];
@@ -109,7 +112,8 @@ static int tpa6130a2_initialize(void)
109 struct tpa6130a2_data *data; 112 struct tpa6130a2_data *data;
110 int i, ret = 0; 113 int i, ret = 0;
111 114
112 BUG_ON(tpa6130a2_client == NULL); 115 if (WARN_ON(!tpa6130a2_client))
116 return -EINVAL;
113 data = i2c_get_clientdata(tpa6130a2_client); 117 data = i2c_get_clientdata(tpa6130a2_client);
114 118
115 for (i = 1; i < TPA6130A2_REG_VERSION; i++) { 119 for (i = 1; i < TPA6130A2_REG_VERSION; i++) {
@@ -127,7 +131,8 @@ static int tpa6130a2_power(u8 power)
127 u8 val; 131 u8 val;
128 int ret = 0; 132 int ret = 0;
129 133
130 BUG_ON(tpa6130a2_client == NULL); 134 if (WARN_ON(!tpa6130a2_client))
135 return -EINVAL;
131 data = i2c_get_clientdata(tpa6130a2_client); 136 data = i2c_get_clientdata(tpa6130a2_client);
132 137
133 mutex_lock(&data->mutex); 138 mutex_lock(&data->mutex);
@@ -193,7 +198,8 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol,
193 unsigned int mask = (1 << fls(max)) - 1; 198 unsigned int mask = (1 << fls(max)) - 1;
194 unsigned int invert = mc->invert; 199 unsigned int invert = mc->invert;
195 200
196 BUG_ON(tpa6130a2_client == NULL); 201 if (WARN_ON(!tpa6130a2_client))
202 return -EINVAL;
197 data = i2c_get_clientdata(tpa6130a2_client); 203 data = i2c_get_clientdata(tpa6130a2_client);
198 204
199 mutex_lock(&data->mutex); 205 mutex_lock(&data->mutex);
@@ -223,7 +229,8 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol,
223 unsigned int val = (ucontrol->value.integer.value[0] & mask); 229 unsigned int val = (ucontrol->value.integer.value[0] & mask);
224 unsigned int val_reg; 230 unsigned int val_reg;
225 231
226 BUG_ON(tpa6130a2_client == NULL); 232 if (WARN_ON(!tpa6130a2_client))
233 return -EINVAL;
227 data = i2c_get_clientdata(tpa6130a2_client); 234 data = i2c_get_clientdata(tpa6130a2_client);
228 235
229 if (invert) 236 if (invert)