public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [bug report] i3c: remove i2c board info from i2c_dev_desc
@ 2022-03-09 15:12 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-03-09 15:12 UTC (permalink / raw)
  To: quic_jiles; +Cc: linux-i3c

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-09 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09 15:12 [bug report] i3c: remove i2c board info from i2c_dev_desc Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox