diff mbox series

[v2] fsl_ucc_hdlc: add a check of the return value from hdlc_open

Message ID 20230828082703.3246-1-adiupina@astralinux.ru (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v2] fsl_ucc_hdlc: add a check of the return value from hdlc_open | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Alexandra Diupina Aug. 28, 2023, 8:27 a.m. UTC
Process the result of hold_open() and return it from
uhdlc_open() in case of an error
It is necessary to pass the error code up the control flow,
similar to a possible error in request_irq()

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
---
v2: Remove the 'rc' variable (stores the return value of the 
hdlc_open()) as Christophe Leroy <christophe.leroy@csgroup.eu> suggested
 drivers/net/wan/fsl_ucc_hdlc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Christophe Leroy Aug. 28, 2023, 8:37 a.m. UTC | #1
Le 28/08/2023 à 10:27, Alexandra Diupina a écrit :
> [Vous ne recevez pas souvent de courriers de adiupina@astralinux.ru. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> Process the result of hold_open() and return it from
> uhdlc_open() in case of an error
> It is necessary to pass the error code up the control flow,
> similar to a possible error in request_irq()
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
> Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
> ---
> v2: Remove the 'rc' variable (stores the return value of the
> hdlc_open()) as Christophe Leroy <christophe.leroy@csgroup.eu> suggested
>   drivers/net/wan/fsl_ucc_hdlc.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)

I think you did a mistake. A v2 should substitute v1, not come in 
addition to it. So you have to squash this patch into previous one 
before resending.

Christophe

> 
> diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
> index cdd9489c712e..4164abea7725 100644
> --- a/drivers/net/wan/fsl_ucc_hdlc.c
> +++ b/drivers/net/wan/fsl_ucc_hdlc.c
> @@ -708,7 +708,6 @@ static int uhdlc_open(struct net_device *dev)
>          hdlc_device *hdlc = dev_to_hdlc(dev);
>          struct ucc_hdlc_private *priv = hdlc->priv;
>          struct ucc_tdm *utdm = priv->utdm;
> -       int rc = 0;
> 
>          if (priv->hdlc_busy != 1) {
>                  if (request_irq(priv->ut_info->uf_info.irq,
> @@ -732,12 +731,10 @@ static int uhdlc_open(struct net_device *dev)
>                  napi_enable(&priv->napi);
>                  netdev_reset_queue(dev);
>                  netif_start_queue(dev);
> -               rc = hdlc_open(dev);
> -               if (rc)
> -                       return rc;
> +               return hdlc_open(dev);
>          }
> 
> -       return rc;
> +       return 0;
>   }
> 
>   static void uhdlc_memclean(struct ucc_hdlc_private *priv)
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index cdd9489c712e..4164abea7725 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -708,7 +708,6 @@  static int uhdlc_open(struct net_device *dev)
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 	struct ucc_hdlc_private *priv = hdlc->priv;
 	struct ucc_tdm *utdm = priv->utdm;
-	int rc = 0;
 
 	if (priv->hdlc_busy != 1) {
 		if (request_irq(priv->ut_info->uf_info.irq,
@@ -732,12 +731,10 @@  static int uhdlc_open(struct net_device *dev)
 		napi_enable(&priv->napi);
 		netdev_reset_queue(dev);
 		netif_start_queue(dev);
-		rc = hdlc_open(dev);
-		if (rc)
-			return rc;
+		return hdlc_open(dev);
 	}
 
-	return rc;
+	return 0;
 }
 
 static void uhdlc_memclean(struct ucc_hdlc_private *priv)