Commit 64d2f4e5 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: gpio: clean up line-state allocation

Clean up allocation of line-state array.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e5032d85
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment