net: make ndev->irq signed for error handling
Subsystems (3)
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
@@ -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
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.Signed-off-by Dan Carpenter <[email protected]>
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
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.Signed-off-by Dan Carpenter <[email protected]>
ndev->irqis 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
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.Signed-off-by Dan Carpenter <[email protected]>
ndev->irqis 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
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.Signed-off-by Dan Carpenter <[email protected]>
ndev->irqis 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
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.Signed-off-by Dan Carpenter <[email protected]>
ndev->irqis 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
David Miller
maintainerFrom: 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.Signed-off-by Dan Carpenter <[email protected]>
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.