On Sat, Aug 31, 2013 at 11:36:09AM -0500, Larry Finger wrote:
> 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.
>
True, while break loops are pretty common for getting the first element
in a list. But the main point is the "pxmitframe = NULL;" line is
unreachable.
regards,
dan carpenter
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel