diff options
| author | Markus Elfring <elfring@users.sourceforge.net> | 2017-11-22 16:11:30 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2017-11-27 08:01:07 -0500 |
| commit | cd9e0b8282653d8bdc2c8b799eeb26ee034cdd06 (patch) | |
| tree | 3c86ff1b6ed8f7f42d658fb354869ab8a92cf206 | |
| parent | e04db58c1252305e8a4d4178a3cfdbef802cff74 (diff) | |
ASoC: cs42l52: Improve two size determinations in cs42l52_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/cs42l52.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index e8645f2ac0d9..9731e5dff291 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
| @@ -1100,8 +1100,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, | |||
| 1100 | unsigned int reg; | 1100 | unsigned int reg; |
| 1101 | u32 val32; | 1101 | u32 val32; |
| 1102 | 1102 | ||
| 1103 | cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_private), | 1103 | cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l52), GFP_KERNEL); |
| 1104 | GFP_KERNEL); | ||
| 1105 | if (cs42l52 == NULL) | 1104 | if (cs42l52 == NULL) |
| 1106 | return -ENOMEM; | 1105 | return -ENOMEM; |
| 1107 | cs42l52->dev = &i2c_client->dev; | 1106 | cs42l52->dev = &i2c_client->dev; |
| @@ -1115,9 +1114,8 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, | |||
| 1115 | if (pdata) { | 1114 | if (pdata) { |
| 1116 | cs42l52->pdata = *pdata; | 1115 | cs42l52->pdata = *pdata; |
| 1117 | } else { | 1116 | } else { |
| 1118 | pdata = devm_kzalloc(&i2c_client->dev, | 1117 | pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), |
| 1119 | sizeof(struct cs42l52_platform_data), | 1118 | GFP_KERNEL); |
| 1120 | GFP_KERNEL); | ||
| 1121 | if (!pdata) | 1119 | if (!pdata) |
| 1122 | return -ENOMEM; | 1120 | return -ENOMEM; |
| 1123 | 1121 | ||
