Skip to contentSkip to conversation

drivers/iio/light/cm3232.c:354 cm3232_probe() warn: this array is probably non-NULL. 'id->name'

PATCH Jonathan Cameron 1 participant 1 message Jan 27, 2015 3 messages not in the archive IIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20150126075258.GS6507@mwanda

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 11AC7173B9064B2091A17EBB49F89149@GustyD430

#3 lore raw
Quoted 10 lines · Kevin Tsai

Hi Jonathan,

Can you help to change as the following:

indio_dev->info = &cm3232_info;
indio_dev->name = id->name;
indio_dev->modes = INDIO_DIRECT_MODE;

Thanks.

Done.

Quoted 58 lines

Kevin Tsai
01/26/15

----- Original Message ----- From: "Jonathan Cameron" <[email protected]>
To: "Dan Carpenter" <[email protected]>; <[email protected]>; "Kevin Tsai" <[email protected]>
Sent: Monday, January 26, 2015 12:54
Subject: Re: [iio:testing 20/20] drivers/iio/light/cm3232.c:354 cm3232_probe() warn: this array is probably non-NULL. 'id->name'

Quoted 48 lines · Dan Carpenter
Quoted 5 lines
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   aa6799c6df77b76230bd150a668be920eba1ebcd
commit: aa6799c6df77b76230bd150a668be920eba1ebcd [20/20] iio: Added Capella cm3232 ambient light sensor driver.

drivers/iio/light/cm3232.c:354 cm3232_probe() warn: this array is probably non-NULL. 'id->name'

Hi Kevin,

Are there any circumstances under which the probe gets called without id non null?

Quoted 36 lines

git remote add iio git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git remote update iio
git checkout aa6799c6df77b76230bd150a668be920eba1ebcd
vim +354 drivers/iio/light/cm3232.c

aa6799c6 Kevin Tsai 2015-01-15  338  struct cm3232_chip *chip;
aa6799c6 Kevin Tsai 2015-01-15  339  struct iio_dev *indio_dev;
aa6799c6 Kevin Tsai 2015-01-15  340  int ret;
aa6799c6 Kevin Tsai 2015-01-15  341
aa6799c6 Kevin Tsai 2015-01-15  342  indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
aa6799c6 Kevin Tsai 2015-01-15  343  if (!indio_dev)
aa6799c6 Kevin Tsai 2015-01-15  344  return -ENOMEM;
aa6799c6 Kevin Tsai 2015-01-15  345
aa6799c6 Kevin Tsai 2015-01-15  346  chip = iio_priv(indio_dev);
aa6799c6 Kevin Tsai 2015-01-15  347  i2c_set_clientdata(client, indio_dev);
aa6799c6 Kevin Tsai 2015-01-15  348  chip->client = client;
aa6799c6 Kevin Tsai 2015-01-15  349
aa6799c6 Kevin Tsai 2015-01-15  350  indio_dev->dev.parent = &client->dev;
aa6799c6 Kevin Tsai 2015-01-15  351  indio_dev->channels = cm3232_channels;
aa6799c6 Kevin Tsai 2015-01-15  352  indio_dev->num_channels = ARRAY_SIZE(cm3232_channels);
aa6799c6 Kevin Tsai 2015-01-15  353  indio_dev->info = &cm3232_info;
aa6799c6 Kevin Tsai 2015-01-15 @354  if (id && id->name)
aa6799c6 Kevin Tsai 2015-01-15  355  indio_dev->name = id->name;
aa6799c6 Kevin Tsai 2015-01-15  356  else
aa6799c6 Kevin Tsai 2015-01-15  357  indio_dev->name = (char *)dev_name(&client->dev);
aa6799c6 Kevin Tsai 2015-01-15  358  indio_dev->modes = INDIO_DIRECT_MODE;
aa6799c6 Kevin Tsai 2015-01-15  359
aa6799c6 Kevin Tsai 2015-01-15  360  ret = cm3232_reg_init(chip);
aa6799c6 Kevin Tsai 2015-01-15  361  if (ret) {
aa6799c6 Kevin Tsai 2015-01-15  362  dev_err(&client->dev,

---
0-DAY kernel test infrastructure Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation