Re: [PATCH][next][V2] net: pcs: xpcs: Fix a less than zero u16 comparison error

From: Vladimir Oltean
Date: Tue Jun 15 2021 - 10:01:15 EST


On Tue, Jun 15, 2021 at 02:52:53PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Currently the check for the u16 variable val being less than zero is
> always false because val is unsigned. Fix this by using the int
> variable for the assignment and less than zero check.
>
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: f7380bba42fd ("net: pcs: xpcs: add support for NXP SJA1110")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
> V2: Fix typo in subject and align the following 2 lines after the
> val = ret & ... assignment. Thanks to Vladimir Oltean for spotting
> these.
> ---

Thanks.

Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>