Skip to content

Commit

Permalink
[PATCH 2/11] drivers/watchdog: Eliminate a NULL pointer dereference
Browse files Browse the repository at this point in the history
At the point of the call to dev_err, wm8350 is NULL.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E == NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
  • Loading branch information
Julia Lawall authored and Wim Van Sebroeck committed Jun 7, 2010
1 parent 386f40c commit cfca31c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/wm8350_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int __devinit wm8350_wdt_probe(struct platform_device *pdev)
struct wm8350 *wm8350 = platform_get_drvdata(pdev);

if (!wm8350) {
dev_err(wm8350->dev, "No driver data supplied\n");
pr_err("No driver data supplied\n");
return -ENODEV;
}

Expand Down

0 comments on commit cfca31c

Please sign in to comment.