• Inaky Perez-Gonzalez's avatar
    wimax/i2400m: fix panic due to missed corner cases on tail_room calculation · 2971a5ba
    Inaky Perez-Gonzalez authored
    i2400m_tx_skip_tail() needs to handle the special case of being called
    when the tail room that is left over in the FIFO is zero.
    
    This happens when a TX message header was opened at the very end of
    the FIFO (without payloads). The i2400m_tx_close() code already marked
    said TX message (header) to be skipped and this function should be
    doing nothing.
    
    It is called anyway because it is part of a common "corner case" path
    handling which takes care of more cases than only this one.
    
    The tail room computation was also improved to take care of the case
    when tx_in is at the end of the buffer boundary; tail_room has to be
    modded (%) to the buffer size. To do that in a single well-documented
    place, __i2400m_tx_tail_room() is introduced and used.
    
    Treat i2400m->tx_in == 0 as a corner case and handle it accordingly.
    
    Found and diagnosed by Cindy H. Kao.
    Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
    2971a5ba
tx.c 32.1 KB