From 36b4894e4a03293f20a7e34e20336f2f05b546d1 Mon Sep 17 00:00:00 2001 From: Aishwarya Pant Date: Wed, 1 Mar 2017 23:54:01 +0530 Subject: [PATCH] staging: bcm2835-camera: prefer allocating memory using sizeof(*ptr) instead of sizeof(struct type name) Using sizeof(*ptr) instead of sizeof(struct type name) is more robust to errors. Signed-off-by: Aishwarya Pant Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 84650d9a8d06..c9a68d4ebd15 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1908,7 +1908,7 @@ static int __init bm2835_mmal_init(void) num_cameras = MAX_BCM2835_CAMERAS; for (camera = 0; camera < num_cameras; camera++) { - dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto cleanup_gdev; -- 2.20.1