re: i2c: pxa: add OF support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux