Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a18c243 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Mauro Carvalho Chehab
Browse files

media: davinci: vpif_capture: add NULL check on devm_kzalloc return value



Check return value from call to devm_kzalloc() in order to prevent
a NULL pointer dereference.

This issue was detected with the help of Coccinelle.

Fixes: 4a5f8ae5 ("[media] davinci: vpif_capture: get subdevs from DT when available")

Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 20772c1a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1550,6 +1550,8 @@ vpif_capture_get_pdata(struct platform_device *pdev)
					    sizeof(*chan->inputs) *
					    VPIF_CAPTURE_NUM_CHANNELS,
					    GFP_KERNEL);
		if (!chan->inputs)
			return NULL;

		chan->input_count++;
		chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;