| .. | .. |
|---|
| 34 | 34 | #define TDM_PPPOHT_SLIC_MAXIN |
|---|
| 35 | 35 | #define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S) |
|---|
| 36 | 36 | |
|---|
| 37 | +static int uhdlc_close(struct net_device *dev); |
|---|
| 38 | + |
|---|
| 37 | 39 | static struct ucc_tdm_info utdm_primary_info = { |
|---|
| 38 | 40 | .uf_info = { |
|---|
| 39 | 41 | .tsa = 0, |
|---|
| .. | .. |
|---|
| 708 | 710 | hdlc_device *hdlc = dev_to_hdlc(dev); |
|---|
| 709 | 711 | struct ucc_hdlc_private *priv = hdlc->priv; |
|---|
| 710 | 712 | struct ucc_tdm *utdm = priv->utdm; |
|---|
| 713 | + int rc = 0; |
|---|
| 711 | 714 | |
|---|
| 712 | 715 | if (priv->hdlc_busy != 1) { |
|---|
| 713 | 716 | if (request_irq(priv->ut_info->uf_info.irq, |
|---|
| .. | .. |
|---|
| 731 | 734 | napi_enable(&priv->napi); |
|---|
| 732 | 735 | netdev_reset_queue(dev); |
|---|
| 733 | 736 | netif_start_queue(dev); |
|---|
| 734 | | - hdlc_open(dev); |
|---|
| 737 | + |
|---|
| 738 | + rc = hdlc_open(dev); |
|---|
| 739 | + if (rc) |
|---|
| 740 | + uhdlc_close(dev); |
|---|
| 735 | 741 | } |
|---|
| 736 | 742 | |
|---|
| 737 | | - return 0; |
|---|
| 743 | + return rc; |
|---|
| 738 | 744 | } |
|---|
| 739 | 745 | |
|---|
| 740 | 746 | static void uhdlc_memclean(struct ucc_hdlc_private *priv) |
|---|
| .. | .. |
|---|
| 823 | 829 | netif_stop_queue(dev); |
|---|
| 824 | 830 | netdev_reset_queue(dev); |
|---|
| 825 | 831 | priv->hdlc_busy = 0; |
|---|
| 832 | + |
|---|
| 833 | + hdlc_close(dev); |
|---|
| 826 | 834 | |
|---|
| 827 | 835 | return 0; |
|---|
| 828 | 836 | } |
|---|
| .. | .. |
|---|
| 1245 | 1253 | free_dev: |
|---|
| 1246 | 1254 | free_netdev(dev); |
|---|
| 1247 | 1255 | undo_uhdlc_init: |
|---|
| 1248 | | - iounmap(utdm->siram); |
|---|
| 1256 | + if (utdm) |
|---|
| 1257 | + iounmap(utdm->siram); |
|---|
| 1249 | 1258 | unmap_si_regs: |
|---|
| 1250 | | - iounmap(utdm->si_regs); |
|---|
| 1259 | + if (utdm) |
|---|
| 1260 | + iounmap(utdm->si_regs); |
|---|
| 1251 | 1261 | free_utdm: |
|---|
| 1252 | 1262 | if (uhdlc_priv->tsa) |
|---|
| 1253 | 1263 | kfree(utdm); |
|---|