提交 36b4894e 编写于 作者: A Aishwarya Pant 提交者: Greg Kroah-Hartman

staging: bcm2835-camera: prefer allocating memory using sizeof(*ptr) instead...

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: NAishwarya Pant <aishpant@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 16255382
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册