summaryrefslogtreecommitdiff
path: root/drivers/media/media-entity.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2016-01-27 12:47:54 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-19 11:45:03 -0200
commitf7b5dff0b59b20469b2a4889e6170c0069d37c8d (patch)
tree80afc6909f835f78a180cab80a9a53196441a1c6 /drivers/media/media-entity.c
parent3df0a7ee0a976ffae998dafb267b8a96622ca278 (diff)
[media] media: Use all bits of an enumeration
The allocation takes place in longs. Assign the size of the enum accordingly. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-entity.c')
-rw-r--r--drivers/media/media-entity.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index f2e43603d6d2..48d87c6f5e90 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -73,8 +73,9 @@ static inline const char *intf_type(struct media_interface *intf)
__must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,
int idx_max)
{
- ent_enum->bmap = kcalloc(DIV_ROUND_UP(idx_max, BITS_PER_LONG),
- sizeof(long), GFP_KERNEL);
+ idx_max = ALIGN(idx_max, BITS_PER_LONG);
+ ent_enum->bmap = kcalloc(idx_max / BITS_PER_LONG, sizeof(long),
+ GFP_KERNEL);
if (!ent_enum->bmap)
return -ENOMEM;