Commit e87f3d53 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Reduce deep indentation

The EDMA case is handled first, so the else condition
can be removed.
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Acked-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7a897203
...@@ -274,49 +274,47 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) ...@@ -274,49 +274,47 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 +
sc->sc_ah->caps.rx_status_len; sc->sc_ah->caps.rx_status_len;
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
return ath_rx_edma_init(sc, nbufs); return ath_rx_edma_init(sc, nbufs);
} else {
ath_dbg(common, CONFIG, "cachelsz %u rxbufsize %u\n",
common->cachelsz, common->rx_bufsize);
/* Initialize rx descriptors */ ath_dbg(common, CONFIG, "cachelsz %u rxbufsize %u\n",
common->cachelsz, common->rx_bufsize);
error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf, /* Initialize rx descriptors */
"rx", nbufs, 1, 0);
if (error != 0) { error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf,
ath_err(common, "rx", nbufs, 1, 0);
"failed to allocate rx descriptors: %d\n", if (error != 0) {
error); ath_err(common,
"failed to allocate rx descriptors: %d\n",
error);
goto err;
}
list_for_each_entry(bf, &sc->rx.rxbuf, list) {
skb = ath_rxbuf_alloc(common, common->rx_bufsize,
GFP_KERNEL);
if (skb == NULL) {
error = -ENOMEM;
goto err; goto err;
} }
list_for_each_entry(bf, &sc->rx.rxbuf, list) { bf->bf_mpdu = skb;
skb = ath_rxbuf_alloc(common, common->rx_bufsize, bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
GFP_KERNEL); common->rx_bufsize,
if (skb == NULL) { DMA_FROM_DEVICE);
error = -ENOMEM; if (unlikely(dma_mapping_error(sc->dev,
goto err; bf->bf_buf_addr))) {
} dev_kfree_skb_any(skb);
bf->bf_mpdu = NULL;
bf->bf_mpdu = skb; bf->bf_buf_addr = 0;
bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, ath_err(common,
common->rx_bufsize, "dma_mapping_error() on RX init\n");
DMA_FROM_DEVICE); error = -ENOMEM;
if (unlikely(dma_mapping_error(sc->dev, goto err;
bf->bf_buf_addr))) {
dev_kfree_skb_any(skb);
bf->bf_mpdu = NULL;
bf->bf_buf_addr = 0;
ath_err(common,
"dma_mapping_error() on RX init\n");
error = -ENOMEM;
goto err;
}
} }
sc->rx.rxlink = NULL;
} }
sc->rx.rxlink = NULL;
err: err:
if (error) if (error)
ath_rx_cleanup(sc); ath_rx_cleanup(sc);
...@@ -334,17 +332,17 @@ void ath_rx_cleanup(struct ath_softc *sc) ...@@ -334,17 +332,17 @@ void ath_rx_cleanup(struct ath_softc *sc)
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
ath_rx_edma_cleanup(sc); ath_rx_edma_cleanup(sc);
return; return;
} else { }
list_for_each_entry(bf, &sc->rx.rxbuf, list) {
skb = bf->bf_mpdu; list_for_each_entry(bf, &sc->rx.rxbuf, list) {
if (skb) { skb = bf->bf_mpdu;
dma_unmap_single(sc->dev, bf->bf_buf_addr, if (skb) {
common->rx_bufsize, dma_unmap_single(sc->dev, bf->bf_buf_addr,
DMA_FROM_DEVICE); common->rx_bufsize,
dev_kfree_skb(skb); DMA_FROM_DEVICE);
bf->bf_buf_addr = 0; dev_kfree_skb(skb);
bf->bf_mpdu = NULL; bf->bf_buf_addr = 0;
} bf->bf_mpdu = NULL;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment