Re: [PATCH] iio: core: WARN in case sample bits do not fit storage bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 20, 2022 at 07:15:42PM +0100, Marek Vasut wrote:
> Add runtime check to verify whether storagebits are at least as big
> as shifted realbits. This should help spot broken drivers which may
> set realbits + shift above storagebits.

Thanks!

...

>  
> +			/* Verify that sample bits fit into storage */
> +			WARN_ON(channels[i].scan_type.storagebits <
> +				channels[i].scan_type.realbits +
> +				channels[i].scan_type.shift);

Not sure WARN is a good level (it might be fatal on some setups and we won't that),
besides the fact that we may use dev_WARN(). Perhaps dev_warn() would suffice?

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux