]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: gpio: clean up line-state allocation
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 19 Mar 2015 15:51:17 +0000 (16:51 +0100)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 19 Mar 2015 16:30:38 +0000 (17:30 +0100)
Clean up allocation of line-state array.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/gpio.c

index a9153a85b01123d6df8580a86a386c4019ebbdec..b18fb7e12a5b5a82649afb5f442a5aed6239d187 100644 (file)
@@ -500,8 +500,6 @@ static void gb_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 
 static int gb_gpio_controller_setup(struct gb_gpio_controller *ggc)
 {
-       u32 line_count;
-       size_t size;
        int ret;
 
        /* First thing we need to do is check the version */
@@ -514,9 +512,8 @@ static int gb_gpio_controller_setup(struct gb_gpio_controller *ggc)
        if (ret)
                return ret;
 
-       line_count = (u32)ggc->line_max + 1;
-       size = line_count * sizeof(*ggc->lines);
-       ggc->lines = kzalloc(size, GFP_KERNEL);
+       ggc->lines = kcalloc(ggc->line_max + 1, sizeof(*ggc->lines),
+                            GFP_KERNEL);
        if (!ggc->lines)
                return -ENOMEM;