diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-11-23 03:33:15 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-11-27 08:00:36 -0500 |
commit | e8d8b98c0a6edab5d6cc0292e1ed603d8d4ff5b6 (patch) | |
tree | 16bfc53a7544e921cbe2e33d74f2dfef26c240ed | |
parent | 277631ccff503f2a8e8150574c9773a8383fc926 (diff) |
ASoC: cs42l56: Improve two size determinations in cs42l56_i2c_probe()
Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/cs42l56.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index 13ee46217d78..fd7b8d32c2b2 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c | |||
@@ -1190,9 +1190,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client, | |||
1190 | unsigned int alpha_rev, metal_rev; | 1190 | unsigned int alpha_rev, metal_rev; |
1191 | unsigned int reg; | 1191 | unsigned int reg; |
1192 | 1192 | ||
1193 | cs42l56 = devm_kzalloc(&i2c_client->dev, | 1193 | cs42l56 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l56), GFP_KERNEL); |
1194 | sizeof(struct cs42l56_private), | ||
1195 | GFP_KERNEL); | ||
1196 | if (cs42l56 == NULL) | 1194 | if (cs42l56 == NULL) |
1197 | return -ENOMEM; | 1195 | return -ENOMEM; |
1198 | cs42l56->dev = &i2c_client->dev; | 1196 | cs42l56->dev = &i2c_client->dev; |
@@ -1207,8 +1205,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client, | |||
1207 | if (pdata) { | 1205 | if (pdata) { |
1208 | cs42l56->pdata = *pdata; | 1206 | cs42l56->pdata = *pdata; |
1209 | } else { | 1207 | } else { |
1210 | pdata = devm_kzalloc(&i2c_client->dev, | 1208 | pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), |
1211 | sizeof(struct cs42l56_platform_data), | ||
1212 | GFP_KERNEL); | 1209 | GFP_KERNEL); |
1213 | if (!pdata) | 1210 | if (!pdata) |
1214 | return -ENOMEM; | 1211 | return -ENOMEM; |