* re: i2c: pxa: add OF support
@ 2013-11-06 16:12 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-11-06 16:12 UTC (permalink / raw)
To: haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hello Haojian Zhuang,
This is a semi-automatic email about new static checker warnings.
The patch 63fe122bce06: "i2c: pxa: add OF support" from Mar 1, 2012,
leads to the following Smatch complaint:
drivers/i2c/busses/i2c-pxa.c:1272 i2c_pxa_probe()
error: we previously assumed 'res' could be null (see line 1161)
drivers/i2c/busses/i2c-pxa.c
1160 irq = platform_get_irq(dev, 0);
1161 if (res == NULL || irq < 0) {
^^^^^^^^^^^
Patch introduces a new error path.
1162 ret = -ENODEV;
1163 goto eclk;
1164 }
1165
[snip]
1267 eremap:
1268 clk_put(i2c->clk);
1269 eclk:
1270 kfree(i2c);
1271 emalloc:
1272 release_mem_region(res->start, resource_size(res));
^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
Null dereferences.
Obviously the unwind needs to be fixed so it's a mirror reflection of
the allocation order. Also the labels are crap. Label names should be
based on the label location and not the goto location(s).
1273 return ret;
1274 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-06 16:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 16:12 i2c: pxa: add OF support Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox