[PATCH] pmc551: fix signedness bug in init_pmc551()

Artem Bityutskiy dedekind1 at gmail.com
Mon Jan 9 16:05:59 EST 2012


On Tue, 2011-12-27 at 15:54 -0500, Xi Wang wrote:
> Since "length" is a u32, the error handling below didn't work when
> fixup_pmc551() returns -ENODEV.
> 
> 	if ((length = fixup_pmc551(PCI_Device)) <= 0)
> 
> This patch changes fixup_pmc551() by separating the error handling
> and the size.
> 
> Signed-off-by: Xi Wang <xi.wang at gmail.com>
> ---
>  drivers/mtd/devices/pmc551.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

You can just change the type to int without introducing a separate
argument. I think the length cannot be too large anyway. E.g., because
it is compared to "asize" which is int.

Artem.




More information about the linux-mtd mailing list