diff mbox series

drivers: net: smc911x: Fix wrong check for irq

Message ID 20211224051254.1565040-1-jiasheng@iscas.ac.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series drivers: net: smc911x: Fix wrong check for irq | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Jiasheng Jiang Dec. 24, 2021, 5:12 a.m. UTC
Because ndev->irq is unsigned, the check is useless.
Therefore, we need to correct the check by using error variable.

Fixes: cb93b3e11d40 ("drivers: net: smc911x: Check for error irq")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/ethernet/smsc/smc911x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jakub Kicinski Dec. 24, 2021, 11:04 p.m. UTC | #1
On Fri, 24 Dec 2021 13:12:54 +0800 Jiasheng Jiang wrote:
> Because ndev->irq is unsigned

It's not..
Andrew Lunn Dec. 25, 2021, 3:11 p.m. UTC | #2
On Fri, Dec 24, 2021 at 03:04:25PM -0800, Jakub Kicinski wrote:
> On Fri, 24 Dec 2021 13:12:54 +0800 Jiasheng Jiang wrote:
> > Because ndev->irq is unsigned
> 
> It's not..

https://elixir.bootlin.com/linux/v5.16-rc6/source/include/linux/netdevice.h#L2065

Definitely an int.

	   Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index dd6f69ced4ee..3118c8b7a8c3 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -2071,11 +2071,11 @@  static int smc911x_drv_probe(struct platform_device *pdev)
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 
 	ndev->dma = (unsigned char)-1;
-	ndev->irq = platform_get_irq(pdev, 0);
-	if (ndev->irq < 0) {
-		ret = ndev->irq;
+
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
 		goto release_both;
-	}
+	ndev->irq = ret;
 
 	lp = netdev_priv(ndev);
 	lp->netdev = ndev;