rtc: rx8010: prefer sizeof(*val) over sizeof(struct type_of_val)
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 14 Sep 2020 15:45:57 +0000 (17:45 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 15 Sep 2020 08:50:37 +0000 (10:50 +0200)
Using the size of the variable is preferred over using the size of its
type when allocating memory. Convert the call to devm_kzalloc() in
probe().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200914154601.32245-11-brgl@bgdev.pl
drivers/rtc/rtc-rx8010.c

index dba7c3f87d9eb9614856a2eea5cbae3f8f372156..aa357f800ad4c9d0537dbdd41cd8a5f20044fd28 100644 (file)
@@ -429,7 +429,7 @@ static int rx8010_probe(struct i2c_client *client,
                return -EIO;
        }
 
-       rx8010 = devm_kzalloc(dev, sizeof(struct rx8010_data), GFP_KERNEL);
+       rx8010 = devm_kzalloc(dev, sizeof(*rx8010), GFP_KERNEL);
        if (!rx8010)
                return -ENOMEM;