diff options
author | Mark Brown <broonie@linaro.org> | 2013-11-08 05:43:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-08 05:43:41 -0500 |
commit | 108145a60675ebc0e42e7964ee6666096bbf86ce (patch) | |
tree | 19266ab0500d7bb188eb53634d484054d59473d2 /sound/soc/codecs/tpa6130a2.c | |
parent | 022aa51e3fda0b3c6688defaa859961c11c36ec8 (diff) | |
parent | bf4edea863c435c302041cf8bb01c8b3ca729449 (diff) |
Merge remote-tracking branch 'asoc/topic/warn' into asoc-next
Diffstat (limited to 'sound/soc/codecs/tpa6130a2.c')
-rw-r--r-- | sound/soc/codecs/tpa6130a2.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 998555f2a8aa..b27c396037d4 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -56,7 +56,8 @@ static int tpa6130a2_i2c_read(int reg) | |||
56 | struct tpa6130a2_data *data; | 56 | struct tpa6130a2_data *data; |
57 | int val; | 57 | int val; |
58 | 58 | ||
59 | BUG_ON(tpa6130a2_client == NULL); | 59 | if (WARN_ON(!tpa6130a2_client)) |
60 | return -EINVAL; | ||
60 | data = i2c_get_clientdata(tpa6130a2_client); | 61 | data = i2c_get_clientdata(tpa6130a2_client); |
61 | 62 | ||
62 | /* If powered off, return the cached value */ | 63 | /* If powered off, return the cached value */ |
@@ -78,7 +79,8 @@ static int tpa6130a2_i2c_write(int reg, u8 value) | |||
78 | struct tpa6130a2_data *data; | 79 | struct tpa6130a2_data *data; |
79 | int val = 0; | 80 | int val = 0; |
80 | 81 | ||
81 | BUG_ON(tpa6130a2_client == NULL); | 82 | if (WARN_ON(!tpa6130a2_client)) |
83 | return -EINVAL; | ||
82 | data = i2c_get_clientdata(tpa6130a2_client); | 84 | data = i2c_get_clientdata(tpa6130a2_client); |
83 | 85 | ||
84 | if (data->power_state) { | 86 | if (data->power_state) { |
@@ -99,7 +101,8 @@ static u8 tpa6130a2_read(int reg) | |||
99 | { | 101 | { |
100 | struct tpa6130a2_data *data; | 102 | struct tpa6130a2_data *data; |
101 | 103 | ||
102 | BUG_ON(tpa6130a2_client == NULL); | 104 | if (WARN_ON(!tpa6130a2_client)) |
105 | return 0; | ||
103 | data = i2c_get_clientdata(tpa6130a2_client); | 106 | data = i2c_get_clientdata(tpa6130a2_client); |
104 | 107 | ||
105 | return data->regs[reg]; | 108 | return data->regs[reg]; |
@@ -110,7 +113,8 @@ static int tpa6130a2_initialize(void) | |||
110 | struct tpa6130a2_data *data; | 113 | struct tpa6130a2_data *data; |
111 | int i, ret = 0; | 114 | int i, ret = 0; |
112 | 115 | ||
113 | BUG_ON(tpa6130a2_client == NULL); | 116 | if (WARN_ON(!tpa6130a2_client)) |
117 | return -EINVAL; | ||
114 | data = i2c_get_clientdata(tpa6130a2_client); | 118 | data = i2c_get_clientdata(tpa6130a2_client); |
115 | 119 | ||
116 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { | 120 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { |
@@ -128,7 +132,8 @@ static int tpa6130a2_power(u8 power) | |||
128 | u8 val; | 132 | u8 val; |
129 | int ret = 0; | 133 | int ret = 0; |
130 | 134 | ||
131 | BUG_ON(tpa6130a2_client == NULL); | 135 | if (WARN_ON(!tpa6130a2_client)) |
136 | return -EINVAL; | ||
132 | data = i2c_get_clientdata(tpa6130a2_client); | 137 | data = i2c_get_clientdata(tpa6130a2_client); |
133 | 138 | ||
134 | mutex_lock(&data->mutex); | 139 | mutex_lock(&data->mutex); |
@@ -194,7 +199,8 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, | |||
194 | unsigned int mask = (1 << fls(max)) - 1; | 199 | unsigned int mask = (1 << fls(max)) - 1; |
195 | unsigned int invert = mc->invert; | 200 | unsigned int invert = mc->invert; |
196 | 201 | ||
197 | BUG_ON(tpa6130a2_client == NULL); | 202 | if (WARN_ON(!tpa6130a2_client)) |
203 | return -EINVAL; | ||
198 | data = i2c_get_clientdata(tpa6130a2_client); | 204 | data = i2c_get_clientdata(tpa6130a2_client); |
199 | 205 | ||
200 | mutex_lock(&data->mutex); | 206 | mutex_lock(&data->mutex); |
@@ -224,7 +230,8 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, | |||
224 | unsigned int val = (ucontrol->value.integer.value[0] & mask); | 230 | unsigned int val = (ucontrol->value.integer.value[0] & mask); |
225 | unsigned int val_reg; | 231 | unsigned int val_reg; |
226 | 232 | ||
227 | BUG_ON(tpa6130a2_client == NULL); | 233 | if (WARN_ON(!tpa6130a2_client)) |
234 | return -EINVAL; | ||
228 | data = i2c_get_clientdata(tpa6130a2_client); | 235 | data = i2c_get_clientdata(tpa6130a2_client); |
229 | 236 | ||
230 | if (invert) | 237 | if (invert) |