Skip to content

Commit f78373e

Browse files
Alexandra Diupinaroxanan1996
authored andcommitted
drivers/net: process the result of hdlc_open() and add call of hdlc_close() in uhdlc_close()
BugLink: https://bugs.launchpad.net/bugs/2045809 [ Upstream commit a59adda ] Process the result of hdlc_open() and call uhdlc_close() 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(). Also add a hdlc_close() call to the uhdlc_close() because the comment to hdlc_close() says it must be called by the hardware driver when the HDLC device is being closed Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c19b6d2 ("drivers/net: support hdlc function for QE-UCC") Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent d68e0b2 commit f78373e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/net/wan/fsl_ucc_hdlc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#define TDM_PPPOHT_SLIC_MAXIN
3535
#define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S)
3636

37+
static int uhdlc_close(struct net_device *dev);
38+
3739
static struct ucc_tdm_info utdm_primary_info = {
3840
.uf_info = {
3941
.tsa = 0,
@@ -705,6 +707,7 @@ static int uhdlc_open(struct net_device *dev)
705707
hdlc_device *hdlc = dev_to_hdlc(dev);
706708
struct ucc_hdlc_private *priv = hdlc->priv;
707709
struct ucc_tdm *utdm = priv->utdm;
710+
int rc = 0;
708711

709712
if (priv->hdlc_busy != 1) {
710713
if (request_irq(priv->ut_info->uf_info.irq,
@@ -728,10 +731,13 @@ static int uhdlc_open(struct net_device *dev)
728731
napi_enable(&priv->napi);
729732
netdev_reset_queue(dev);
730733
netif_start_queue(dev);
731-
hdlc_open(dev);
734+
735+
rc = hdlc_open(dev);
736+
if (rc)
737+
uhdlc_close(dev);
732738
}
733739

734-
return 0;
740+
return rc;
735741
}
736742

737743
static void uhdlc_memclean(struct ucc_hdlc_private *priv)
@@ -821,6 +827,8 @@ static int uhdlc_close(struct net_device *dev)
821827
netdev_reset_queue(dev);
822828
priv->hdlc_busy = 0;
823829

830+
hdlc_close(dev);
831+
824832
return 0;
825833
}
826834

0 commit comments

Comments
 (0)