[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20101219205809.GM1936@bicker>
Date: Sun, 19 Dec 2010 23:58:09 +0300
From: Dan Carpenter <error27@...il.com>
To: Cory Maccarrone <darkstar6262@...il.com>
Cc: linux-kernel@...r.kernel.org, Samuel Ortiz <sameo@...ux.intel.com>
Subject: [bug report] mfd/htc-i2cpld.c wrong check in htcpld_chip_get()
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists