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

Commit 6f51bc34 authored by LABBE Corentin's avatar LABBE Corentin Committed by Peter Chen
Browse files

usb: chipidea: imx: fix a possible NULL dereference



of_match_device could return NULL, and so cause a NULL pointer
dereference later.

Reported-by: coverity (CID 1324138)
Signed-off-by: default avatarLABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
parent 090bc267
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -247,9 +247,14 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
		.flags		= CI_HDRC_SET_NON_ZERO_TTHA,
	};
	int ret;
	const struct of_device_id *of_id =
			of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
	const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data;
	const struct of_device_id *of_id;
	const struct ci_hdrc_imx_platform_flag *imx_platform_flag;

	of_id = of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
	if (!of_id)
		return -ENODEV;

	imx_platform_flag = of_id->data;

	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
	if (!data)