mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 00:25:24 -04:00
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 <aishpant@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1625538220
commit
36b4894e4a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user