]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: greybus: light: fix attributes allocation
authorRui Miguel Silva <rmfrfs@gmail.com>
Fri, 30 Sep 2016 18:24:32 +0000 (19:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Oct 2016 13:49:26 +0000 (15:49 +0200)
Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/light.c

index b2847feb7e86a3cbde5a09f3c5fcb767fe2b5605..f3cd48521af054cd4302b8937aae28378307b527 100644 (file)
@@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel *channel,
                return 0;
 
        /* Set attributes based in the channel flags */
-       channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
-                                GFP_KERNEL);
+       channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
        if (!channel->attrs)
                return -ENOMEM;
        channel->attr_group = kcalloc(1, sizeof(*channel->attr_group),