On 08/29/2013 04:48 PM, Dan Carpenter wrote:
Hello Larry Finger,
The patch d6846af679e0: "staging: r8188eu: Add files for new driver -
part 7" from Aug 21, 2013, leads to the following Smatch warning:
"drivers/staging/rtl8188eu/core/rtw_xmit.c:1570
dequeue_one_xmitframe() info: ignoring unreachable code."
1559 while (!rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) {
1560 pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
1561
1562 xmitframe_plist = get_next(xmitframe_plist);
1563
1564 rtw_list_delete(&pxmitframe->list);
1565
1566 ptxservq->qcnt--;
1567
1568 break;
^^^^^
Is there supposed to be an if statement with this break? This is a loop
that doesn't loop.
1569
1570 pxmitframe = NULL;
^^^^^^^^^^^^^^^^^
Is this bit important?
1571 }
1572
1573 return pxmitframe;
regards,
dan carpenter
Dan,
Despite the unorthodox look of the code, I think it is doing the right thing. If
there is an entry on the xmitframe queue, it extracts it, does some
housekeeping, and returns a pointer to the entry. If the queue is empty, then it
returns NULL.
There are other Realtek drivers that have the same structure, and I suspect a
long-time error that has been propagated by copy and paste. I will contact the
Realtek engineers to see what they say, but I think a patch that leads to the
following pcode will be in order:
if (!rtw_end_of_queue_search())
pxmitframe = ...
rest of housekeeping
}
return pxmitframe
While awaiting their response, I will be testing this patch.
Thanks,
Larry
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel