* [bug report] mfd/htc-i2cpld.c wrong check in htcpld_chip_get()
@ 2010-12-19 20:58 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-12-19 20:58 UTC (permalink / raw)
To: Cory Maccarrone; +Cc: linux-kernel, Samuel Ortiz
Hi Cory,
Smatch complains that the check is wrong on line 280 from
drivers/mfd/htc-i2cpld.c
drivers/mfd/htc-i2cpld.c +280 htcpld_chip_get(12)
warn: can 'chip_data' even be NULL?
278 /* Try out first */
279 chip_data = container_of(chip, struct htcpld_chip, chip_out);
280 if (!chip_data) {
281 /* Try in */
282 is_input = 1;
283 chip_data = container_of(chip, struct htcpld_chip, chip_in);
284 if (!chip_data)
285 return -EINVAL;
286 }
container_of() takes the chip pointer and subtracts a small number (it
subtracts the offset of the chip_out element from the start of the
htcpld_chip struct). So basically it's never NULL. I'm not sure what
the correct check should be here, can you take a look?
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-19 20:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-19 20:58 [bug report] mfd/htc-i2cpld.c wrong check in htcpld_chip_get() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox