staging:vt6655: remove checks around dev_kfree_skb
Hi Dan,
Quoted 12 lines
I hate these patches. I have told Markus to stop sending them but he has issues so now I only complain when they introduce a bug. There was one bug I have missed because it was a benchmark regression and I knew it was theoretically possible but I didn't know the code well enough to say which were fast paths...
My main objection is that relying on the sanity check inside the function call makes the code more subtle to understand. We know we need a NULL check but it is hidden away in another file. The motivation for this patch you are sending is "There is a sanity check in
dev_kfree_skb()so let's do an insane thing and save some lines of code."
Quoted 3 lines
For this particular patch we assume throughout the whole driver that "
pTDInfo->skb" can be NULL so making it inconsistent in this one place is wrong
Agreed,
But these changes are suggested because:-
where we are checking for (pTDInfo->skb), we are using it in above line. and it does not look good, thats why we should remove thse checks and i have suggested changes.
code snippet:-
-----------------------
if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma,
pTDInfo->skb->len, DMA_TO_DEVICE);----> In this we did not check for pTDInfo->skb
if (pTDInfo->skb)
dev_kfree_skb(pTDInfo->skb);
But if am wrong, sorry for the patch.
Thanks,
Maninder ............ÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥
Quoted 8 lines · Maninder Singh
where we are checking for (
pTDInfo->skb), we are using it in above line. and it does not look good, thats why we should remove thse checks and i have suggested changes.code snippet:-
-----------------------if (
pTDInfo->skb_dma&& (pTDInfo->skb_dma!=pTDInfo->buf_dma))
^^^^^^^^^^^^^^^^
This is allocated after ->skb so if ->skb_dma is non-NULL then ->skb is also non-NULL.
Quoted 2 lines
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma,
pTDInfo->skb->len, DMA_TO_DEVICE);Is this a static checker warning? If so then it's a false positive.
regards,
dan carpenter
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Maninder Singh
where we are checking for (
pTDInfo->skb), we are using it in above line. and it does not look good, thats why we should remove thse checks and i have suggested changes.code snippet:-
-----------------------if (
pTDInfo->skb_dma&& (pTDInfo->skb_dma!=pTDInfo->buf_dma))
Quoted 9 lines
^^^^^^^^^^^^^^^^This is allocated after ->skb so if ->skb_dma is non-NULL then ->skb is also non-NULL.
Quoted 2 lines
dma_unmap_single(&pDevice->pcid->dev, pTDInfo->skb_dma, pTDInfo->skb->len, DMA_TO_DEVICE);Is this a static checker warning? If so then it's a false positive.
This is old code dma_unmap_single never happens and is to be removed.
pTDInfo->skb now originates from mac80211.
I am in the process of tiding up pTDInfo that removes skb_dma.
In the past, this driver several API's sharing the same device now it has just one.
Regards
Malcolm