Re: FP with unreachable code check

Dan Carpenter <[email protected]> Wed, 7 Aug 2024 07:23:28 -0500
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
On Mon, Aug 05, 2024 at 02:55:52PM +0530, Harshit Mogalapalli wrote:
> Hi Dan,
> 
> 
> I think iio_device_claim_direct_scoped() needs special handling, for some
> reason smatch thinks all these calls are not reachable.
> 
> drivers/iio/adc/ad7380.c:371 ad7380_debugfs_reg_access() warn: ignoring
> unreachable code.
> drivers/iio/adc/ad7380.c:500 ad7380_read_raw() warn: ignoring unreachable
> code.
> drivers/iio/adc/ad7380.c:589 ad7380_write_raw() warn: ignoring unreachable
> code.
> drivers/iio/adc/ad7606.c:153 ad7606_read_raw() warn: ignoring unreachable
> code.
> 

The simplest thing would be to add iio_device_claim_direct_scoped()
to smatch_data/kernel.unreachable.ignore.  Although probably the correct
thing is to check the next statement and silence the warning if it's
unreachable().

regards,
dan carpenter