[PATCH v2 2/3] staging: greybus: light: fix attributes allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/staging/greybus/light.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index b2847fe..f3cd485 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -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),
-- 
2.10.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux