Skip to content

Commit

Permalink
mfd: sm501: Improve a size determination in two functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
elfring authored and Lee Jones committed May 16, 2018
1 parent a9241b0 commit 3eec4fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mfd/sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ static int sm501_plat_probe(struct platform_device *dev)
struct sm501_devdata *sm;
int ret;

sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
sm = kzalloc(sizeof(*sm), GFP_KERNEL);
if (sm == NULL) {
ret = -ENOMEM;
goto err1;
Expand Down Expand Up @@ -1572,7 +1572,7 @@ static int sm501_pci_probe(struct pci_dev *dev,
struct sm501_devdata *sm;
int err;

sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
sm = kzalloc(sizeof(*sm), GFP_KERNEL);
if (sm == NULL) {
err = -ENOMEM;
goto err1;
Expand Down

0 comments on commit 3eec4fa

Please sign in to comment.