Skip to content

Commit

Permalink
usb: musb: omap2430: fix wrong devm_kzalloc() result check
Browse files Browse the repository at this point in the history
Commit 00a0b1d (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 <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Sergei Shtylyov authored and Felipe Balbi committed Jan 17, 2013
1 parent 25736e0 commit b37457d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/musb/omap2430.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b37457d

Please sign in to comment.