summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/gpio.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-03-19 16:51:17 +0100
committerGreg Kroah-Hartman <greg@kroah.com>2015-03-19 17:30:38 +0100
commit64d2f4e5f94a95b23532efcbc3c955b5086bd890 (patch)
tree64dd0a20e75036d44d4e97ab73d0963867d6727d /drivers/staging/greybus/gpio.c
parente5032d8511cdb0b7b594863effa2c2a685beaaa5 (diff)
greybus: gpio: clean up line-state allocation
Clean up allocation of line-state array. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/gpio.c')
-rw-r--r--drivers/staging/greybus/gpio.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index a9153a85b011..b18fb7e12a5b 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -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;