diff mbox series

[v2] drivers: net: smc911x: Check for error irq

Message ID 20211223123232.1353785-1-jiasheng@iscas.ac.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v2] drivers: net: smc911x: Check for error 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 warning 1 maintainers not CCed: colin.king@intel.com
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, 13 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. 23, 2021, 12:32 p.m. UTC
On Thursday, December 23, 2021, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> Do other way around.
> ret = ...
> if (ret < 0)
>   ...
> irq = ret;

This version I correct the patch by using error variable, too.
And the commit message is as follow.

Because platform_get_irq() could fail and return error irq.
Therefore, it might be better to check it in order to avoid the use of
error irq.

Fixes: ae150435b59e ("smsc: Move the SMC (SMSC) drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changlog:

v1 -> v2

*Change 1. Using error varaible to check.
---
 drivers/net/ethernet/smsc/smc911x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko Dec. 23, 2021, 12:37 p.m. UTC | #1
On Thu, Dec 23, 2021 at 2:33 PM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
> On Thursday, December 23, 2021, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > Do other way around.
> > ret = ...
> > if (ret < 0)
> >   ...
> > irq = ret;
>
> This version I correct the patch by using error variable, too.
> And the commit message is as follow.
>
> Because platform_get_irq() could fail and return error irq.
> Therefore, it might be better to check it in order to avoid the use of
> error irq.

Fix commit message and send v3.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 22cdbf12c823..9470d9c07fed 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -2069,7 +2069,12 @@  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);
+
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto release_both;
+	ndev->irq = ret;
+
 	lp = netdev_priv(ndev);
 	lp->netdev = ndev;
 #ifdef SMC_DYNAMIC_BUS_CONFIG