Skip to content

Commit

Permalink
[ath9k] Remove broken ath_rxbuf_alloc()
Browse files Browse the repository at this point in the history
ath_rx_init() demonstrates some serious confusion over how to use
pointers, resulting in (uint32_t*)NULL being used as a temporary
variable.  This does not end well.

The broken code in question is performing manual alignment of I/O
buffers, which can now be achieved more simply using alloc_iob_raw().
Fix by removing ath_rxbuf_alloc() entirely.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jan 28, 2016
1 parent 4ddd3d9 commit d0bfd83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 70 deletions.
4 changes: 0 additions & 4 deletions src/drivers/net/ath/ath.h
Expand Up @@ -229,10 +229,6 @@ struct ath_common {
int btcoex_enabled;
};

struct io_buffer *ath_rxbuf_alloc(struct ath_common *common,
u32 len,
u32 *iob_addr);

void ath_hw_setbssidmask(struct ath_common *common);
int ath_hw_keyreset(struct ath_common *common, u16 entry);
void ath_hw_cycle_counters_update(struct ath_common *common);
Expand Down
12 changes: 5 additions & 7 deletions src/drivers/net/ath/ath9k/ath9k_recv.c
Expand Up @@ -98,7 +98,6 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
{
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct io_buffer *iob;
u32 *iob_addr = NULL;
struct ath_buf *bf;
int error = 0;

Expand All @@ -122,15 +121,14 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
}

list_for_each_entry(bf, &sc->rx.rxbuf, list) {
iob = ath_rxbuf_alloc(common, common->rx_bufsize,
iob_addr);
iob = alloc_iob_raw ( common->rx_bufsize, common->cachelsz, 0 );
if (iob == NULL) {
error = -ENOMEM;
goto err;
}

bf->bf_mpdu = iob;
bf->bf_buf_addr = *iob_addr;
bf->bf_buf_addr = virt_to_bus ( iob->data );
}
sc->rx.rxlink = NULL;

Expand Down Expand Up @@ -433,7 +431,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)
{
struct ath_buf *bf;
struct io_buffer *iob = NULL, *requeue_iob;
u32 *requeue_iob_addr = NULL;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
/*
Expand Down Expand Up @@ -476,7 +473,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)

/* Ensure we always have an iob to requeue once we are done
* processing the current buffer's iob */
requeue_iob = ath_rxbuf_alloc(common, common->rx_bufsize, requeue_iob_addr);
requeue_iob = alloc_iob_raw ( common->rx_bufsize,
common->cachelsz, 0 );

/* If there is no memory we ignore the current RX'd frame,
* tell hardware it can give us a new frame using the old
Expand All @@ -491,7 +489,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)

/* We will now give hardware our shiny new allocated iob */
bf->bf_mpdu = requeue_iob;
bf->bf_buf_addr = *requeue_iob_addr;
bf->bf_buf_addr = virt_to_bus ( requeue_iob->data );

/*
* change the default rx antenna if rx diversity chooses the
Expand Down
59 changes: 0 additions & 59 deletions src/drivers/net/ath/ath_main.c

This file was deleted.

0 comments on commit d0bfd83

Please sign in to comment.