From: Sergei Shtylyov Date: Tue, 8 Jan 2013 19:11:14 +0000 (+0300) Subject: usb: musb: omap2430: fix wrong devm_kzalloc() result check X-Git-Tag: v3.9-rc1~126^2~45^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b37457d80bc3e2a6bb86a6036c572574614a7631;p=platform%2Fkernel%2Flinux-3.10.git usb: musb: omap2430: fix wrong devm_kzalloc() result check Commit 00a0b1d58af873d842580dcac55f3b156c3a4077 (usb: musb: omap: Add device tree support for omap musb glue) assigns result of devm_kzalloc() call to the 'config' variable but then checks for NULL the 'data' variable (already checked after previous call). Thus we risk a kernel oops further when data pointed by 'config' is written to by subsequent of_property_read_u32() calls iff the allocation happens to fail... Signed-off-by: Sergei Shtylyov Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index b15bb05..bb48796 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -543,7 +543,7 @@ static int omap2430_probe(struct platform_device *pdev) } config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); - if (!data) { + if (!config) { dev_err(&pdev->dev, "failed to allocate musb hdrc config\n"); goto err2;