From: Dan Carpenter <dan.carpenter@oracle.com>
To: quic_jiles@quicinc.com
Cc: linux-i3c@lists.infradead.org
Subject: [bug report] i3c: remove i2c board info from i2c_dev_desc
Date: Wed, 9 Mar 2022 18:12:27 +0300 [thread overview]
Message-ID: <20220309151227.GA6714@kili> (raw)
Hello Jamie Iles,
The patch 31b9887c7258: "i3c: remove i2c board info from
i2c_dev_desc" from Jan 17, 2022, leads to the following Smatch static
checker warning:
drivers/i3c/master.c:2311 i3c_master_i2c_adapter_init()
error: potentially dereferencing uninitialized 'i2cdev'.
drivers/i3c/master.c
2286 static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
2287 {
2288 struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
2289 struct i2c_dev_desc *i2cdev;
^^^^^^
2290 struct i2c_dev_boardinfo *i2cboardinfo;
2291 int ret;
2292
2293 adap->dev.parent = master->dev.parent;
2294 adap->owner = master->dev.parent->driver->owner;
2295 adap->algo = &i3c_master_i2c_algo;
2296 strncpy(adap->name, dev_name(master->dev.parent), sizeof(adap->name));
2297
2298 /* FIXME: Should we allow i3c masters to override these values? */
2299 adap->timeout = 1000;
2300 adap->retries = 3;
2301
2302 ret = i2c_add_adapter(adap);
2303 if (ret)
2304 return ret;
2305
2306 /*
2307 * We silently ignore failures here. The bus should keep working
2308 * correctly even if one or more i2c devices are not registered.
2309 */
2310 list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
--> 2311 i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
^^^^^^
Uninitialized
2312
2313 return 0;
2314 }
regards,
dan carpenter
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
reply other threads:[~2022-03-09 15:13 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=20220309151227.GA6714@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-i3c@lists.infradead.org \
--cc=quic_jiles@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox