mfd: sm501: Improve a size determination in two functions
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 8 Mar 2018 13:05:41 +0000 (14:05 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 16 May 2018 08:21:48 +0000 (09:21 +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>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/sm501.c

index 7298d6b571a18980c416fca406a33488a27a4d7e..4f4957ea8fa3145b900c529fbe073413e393f8aa 100644 (file)
@@ -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;
@@ -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;