Skip to contentSkip to conversation

net: make ndev->irq signed for error handling

PATCH In review Dan Carpenter 3 participants 7 messages Nov 7, 2013 – Nov 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: make ndev->irq signed for error handling

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

include/linux/netdevice.h +1 -1
index 9da6a04..bb011f6 100644
@@ -1132,7 +1132,7 @@ struct net_device {
 	unsigned long		mem_end;	/* shared mem end	*/
 	unsigned long		mem_start;	/* shared mem start	*/
 	unsigned long		base_addr;	/* device I/O address	*/
-	unsigned int		irq;		/* device IRQ number	*/
+	int			irq;		/* device IRQ number	*/
 
 	/*
 	 *	Some hardware also needs these fields, but they are not
#1 lore raw
Quoted 9 lines · Dan Carpenter

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

ndev->irq is never used any where in the driver, I think its better to remove this part of code from probe. If every one is ok, I can send a patch to remove the code.

Regards
Mugunthan V N

#2 lore raw
Quoted 6 lines · Mugunthan V N
Quoted 5 lines · Dan Carpenter

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {
Quoted 7 lines
Quoted 4 lines

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

ndev->irq is never used any where in the driver, I think its better to remove this part of code from probe. If every one is ok, I can send a patch to remove the code.

It seems like cpsw_ndo_poll_controller() uses it.

regards,
dan carpenter

#3 lore raw
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Mugunthan V N
Quoted 5 lines · Dan Carpenter

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

ndev->irq is never used any where in the driver, I think its better to remove this part of code from probe. If every one is ok, I can send a patch to remove the code.

It seems like cpsw_ndo_poll_controller() uses it.

That can be changed to pass one of the interrupt numbers from priv as the irq number is not used in interrupt service routine.

Regards
Mugunthan V N

maintainer
#6 lore raw
In reply to Dan Carpenter

From: Dan Carpenter <[email protected]>
Date: Thu, 7 Nov 2013 10:48:49 +0300

Quoted 9 lines

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

Even though some simplifications have been suggested wrt. how this irq value is obtained in the one place where it is used, I am applying Dan's patch for now.

#4 lore raw
In reply to Mugunthan V N
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Dan Carpenter
Quoted 13 lines · Mugunthan V N
Quoted 9 lines · Dan Carpenter

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

ndev->irq is never used any where in the driver, I think its better to remove this part of code from probe. If every one is ok, I can send a patch to remove the code.

Quoted 6 lines
Quoted 3 lines

It seems like cpsw_ndo_poll_controller() uses it.

That can be changed to pass one of the interrupt numbers from priv as the irq number is not used in interrupt service routine.

I don't know anything about this driver, so I'm fine with your idea.

regards,
dan carpenter

#5 lore raw
Quoted 16 lines · Dan Carpenter
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Dan Carpenter
Quoted 13 lines · Mugunthan V N
Quoted 9 lines · Dan Carpenter

There is a bug in cpsw_probe() where we do:

	ndev->irq = platform_get_irq(pdev, 0);
	if (ndev->irq < 0) {

The problem is that "ndev->irq" is unsigned so the error handling doesn't work. I have changed it to a regular int.

ndev->irq is never used any where in the driver, I think its better to remove this part of code from probe. If every one is ok, I can send a patch to remove the code.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

It seems like cpsw_ndo_poll_controller() uses it.

That can be changed to pass one of the interrupt numbers from priv as the irq number is not used in interrupt service routine.

I don't know anything about this driver, so I'm fine with your idea.

Anyhow David has applied your patch, I will send a driver cleanup patch seperately.

Regards
Mugunthan V N