diff mbox

[-next] bcma: signedness bug in bcma_get_next_core()

Message ID 20110818133809.GG4786@shale.localdomain (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Dan Carpenter Aug. 18, 2011, 1:38 p.m. UTC
The u32 would never be less than zero so the error handling would
break.  I changed it to int.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dan Carpenter Aug. 23, 2011, 7:13 p.m. UTC | #1
On Sat, Aug 20, 2011 at 02:23:56PM +0200, Rafa? Mi?ecki wrote:
> W dniu 18 sierpnia 2011 15:38 u?ytkownik Dan Carpenter
> <error27@gmail.com> napisa?:
> > The u32 would never be less than zero so the error handling would
> > break.  I changed it to int.
> 
> In declaration we use s32:
> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
> 
> Doesn't it sound better to use s32 instead of int?
>

I don't know.  I think I'm going to trust the original author on this
one.  I'll send you a v2 that uses s32.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafał Miłecki Aug. 24, 2011, 10:01 a.m. UTC | #2
W dniu 23 sierpnia 2011 21:13 u?ytkownik Dan Carpenter
<error27@gmail.com> napisa?:
> On Sat, Aug 20, 2011 at 02:23:56PM +0200, Rafa? Mi?ecki wrote:
>> W dniu 18 sierpnia 2011 15:38 u?ytkownik Dan Carpenter
>> <error27@gmail.com> napisa?:
>> > The u32 would never be less than zero so the error handling would
>> > break.  I changed it to int.
>>
>> In declaration we use s32:
>> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
>>
>> Doesn't it sound better to use s32 instead of int?
>>
>
> I don't know.  I think I'm going to trust the original author on this
> one.  I'll send you a v2 that uses s32.

Dan, I asked you to use int in both: call and function declaration.
I'm the author of that code, and I don't have anything against
modifying that :)

I think int is used much more often that s32 for errors.
Dan Carpenter Aug. 24, 2011, 10:17 a.m. UTC | #3
On Wed, Aug 24, 2011 at 12:01:11PM +0200, Rafa? Mi?ecki wrote:
> Dan, I asked you to use int in both: call and function declaration.
> I'm the author of that code, and I don't have anything against
> modifying that :)
> 
> I think int is used much more often that s32 for errors.
> 

No problem.  Should I make bcma_erom_get_mst_port() return 0 on
success while I'm at it?

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 0ea390f..1361d8d 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -281,7 +281,7 @@  static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 
 	/* get & parse master ports */
 	for (i = 0; i < ports[0]; i++) {
-		u32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
+		int mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
 		if (mst_port_d < 0)
 			return -EILSEQ;
 	}