RE: [PATCH] iio: magnetometer: yas530: Use signed integer type for clamp limits

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

 



From: Jakob Hauser
> Sent: 29 November 2024 00:20
...
> > and it should be clamp() not clamp_val().
> 
> I assumed that clamp_val() is still needed because according to its
> description in current mainline (6.12) include/linux/minmax.h, clamp()
> does "strict typechecking". The input value h[] is of type s32 and the
> limits derived from "half_range" are of type int. I had a try compiling
> with clamp() and didn't get any warnings or errors. Does that mean that
> clamp() isn't that strict in the current implementation (and considering
> the patch being backported)? Does it just check signedness and is this
> because in current __clamp_once() it uses __auto_type?

The current mainline contains relaxed checks - the comment is wrong.

In any case, after the change, they ate all 'int'.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[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