Re: [PATCH 1/2] fixes warning

From: Mark Brown
Date: Fri Aug 04 2023 - 07:57:10 EST


On Fri, Aug 04, 2023 at 05:21:20PM +0530, coolrrsh@xxxxxxxxx wrote:
> From: Rajeshwar R Shinde <coolrrsh@xxxxxxxxx>
>
> drivers/spi/spi-mpc512x-psc.c:493:5-13:
> WARNING: Unsigned expression compared with zero: mps -> irq < 0

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.

> mps->irq = platform_get_irq(pdev, 0);
> - if (mps->irq < 0)
> + if ((int)mps->irq < 0)
> return mps->irq;

Casts are almost always the wrong choice. If the issue is that the
value is unsigned and can't be negative casting it to signed isn't going
to help, though here possibly the type of the variable is wrong.

Attachment: signature.asc
Description: PGP signature