From: Dan Carpenter <error27@gmail.com>
To: Cory Maccarrone <darkstar6262@gmail.com>
Cc: linux-kernel@vger.kernel.org, Samuel Ortiz <sameo@linux.intel.com>
Subject: [bug report] mfd/htc-i2cpld.c wrong check in htcpld_chip_get()
Date: Sun, 19 Dec 2010 23:58:09 +0300 [thread overview]
Message-ID: <20101219205809.GM1936@bicker> (raw)
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
reply other threads:[~2010-12-19 20:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101219205809.GM1936@bicker \
--to=error27@gmail.com \
--cc=darkstar6262@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.