Skip to contentSkip to conversation

iio: light: new driver for the ROHM BH1780

DISCUSSION Dan Carpenter 1 participant 1 message Apr 28, 2016 IIO

lore
Share & tools
lore
#0 lore raw

Hello Linus Walleij,

This is a semi-automatic email about new static checker warnings.

The patch 1f0477f18306: "iio: light: new driver for the ROHM BH1780" from Apr 11, 2016, leads to the following Smatch complaint:

drivers/iio/light/bh1780.c:93 bh1780_debugfs_reg_access()
error: we previously assumed 'readval' could be null (see line 86)

drivers/iio/light/bh1780.c

    85	
    86		if (!readval)
                    ^^^^^^^^
    87			bh1780_write(bh1780, (u8)reg, (u8)writeval);

Should this be:

			return bh1780_write(bh1780, (u8)reg, (u8)writeval);

    88	
    89		ret = bh1780_read(bh1780, (u8)reg);
    90		if (ret < 0)
    91			return ret;
    92	
    93		*readval = ret;
                ^^^^^^^^
    94	
    95		return 0;

regards,
dan carpenter