lkml.org 
[lkml]   [2017]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/4] ASoC: twl4030: Improve a size determination in two functions
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 21:45:55 +0100

Replace the specification of 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>
---
sound/soc/codecs/twl4030.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index a1f0b45c83ca..946818a0412c 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -236,9 +236,7 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec)
"codec");

if (!pdata && twl4030_codec_node) {
- pdata = devm_kzalloc(codec->dev,
- sizeof(struct twl4030_codec_data),
- GFP_KERNEL);
+ pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
goto put_node;

@@ -2168,8 +2166,7 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
{
struct twl4030_priv *twl4030;

- twl4030 = devm_kzalloc(codec->dev, sizeof(struct twl4030_priv),
- GFP_KERNEL);
+ twl4030 = devm_kzalloc(codec->dev, sizeof(*twl4030), GFP_KERNEL);
if (!twl4030)
return -ENOMEM;
snd_soc_codec_set_drvdata(codec, twl4030);
--
2.15.0
\
 
 \ /
  Last update: 2017-11-23 22:12    [W:0.111 / U:1.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site