hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/wan/fsl_ucc_hdlc.c
....@@ -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,
....@@ -708,6 +710,7 @@
708710 hdlc_device *hdlc = dev_to_hdlc(dev);
709711 struct ucc_hdlc_private *priv = hdlc->priv;
710712 struct ucc_tdm *utdm = priv->utdm;
713
+ int rc = 0;
711714
712715 if (priv->hdlc_busy != 1) {
713716 if (request_irq(priv->ut_info->uf_info.irq,
....@@ -731,10 +734,13 @@
731734 napi_enable(&priv->napi);
732735 netdev_reset_queue(dev);
733736 netif_start_queue(dev);
734
- hdlc_open(dev);
737
+
738
+ rc = hdlc_open(dev);
739
+ if (rc)
740
+ uhdlc_close(dev);
735741 }
736742
737
- return 0;
743
+ return rc;
738744 }
739745
740746 static void uhdlc_memclean(struct ucc_hdlc_private *priv)
....@@ -823,6 +829,8 @@
823829 netif_stop_queue(dev);
824830 netdev_reset_queue(dev);
825831 priv->hdlc_busy = 0;
832
+
833
+ hdlc_close(dev);
826834
827835 return 0;
828836 }
....@@ -1245,9 +1253,11 @@
12451253 free_dev:
12461254 free_netdev(dev);
12471255 undo_uhdlc_init:
1248
- iounmap(utdm->siram);
1256
+ if (utdm)
1257
+ iounmap(utdm->siram);
12491258 unmap_si_regs:
1250
- iounmap(utdm->si_regs);
1259
+ if (utdm)
1260
+ iounmap(utdm->si_regs);
12511261 free_utdm:
12521262 if (uhdlc_priv->tsa)
12531263 kfree(utdm);