Skip to content

Commit 748c23d

Browse files
elfringEduardo Valentin
authored andcommitted
ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()
A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. Acked-by: Keerthy <j-keerthy@ti.com> Tested-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
1 parent c4b379d commit 748c23d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/thermal/ti-soc-thermal/ti-bandgap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
12241224
bgp->conf = of_id->data;
12251225

12261226
/* register shadow for context save and restore */
1227-
bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
1228-
bgp->conf->sensor_count, GFP_KERNEL);
1227+
bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
1228+
sizeof(*bgp->regval), GFP_KERNEL);
12291229
if (!bgp->regval) {
12301230
dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
12311231
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)