[PATCH 2/2] atm: Improve a size determination in adummy_init()

From: SF Markus Elfring
Date: Sun Oct 01 2017 - 15:50:49 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 1 Oct 2017 21:35:18 +0200

Replace the specification of a data structure by a pointer dereference
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@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/atm/adummy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 94b73ddfb731..1ef2d8ee8d67 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -146,9 +146,7 @@ static int __init adummy_init(void)
int err = 0;

printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);
-
- adummy_dev = kzalloc(sizeof(struct adummy_dev),
- GFP_KERNEL);
+ adummy_dev = kzalloc(sizeof(*adummy_dev), GFP_KERNEL);
if (!adummy_dev) {
err = -ENOMEM;
goto out;
--
2.14.2