Skip to contentSkip to conversation

staging/comedi: remove unnecessary check around pci_dev_put

PATCH Maninder Singh 1 participant 1 message Jun 25, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 8 lines

This patch is correct but the motivation is wrong.

The check in pci_dev_put() is like a sanity check. There are many functions which have a sanity check and many which do not, it is impossible for a human to remember the complete list of each. When we remove explicit checks for NULL and instead rely on the sanity checks it sometimes makes the code more subtle and difficult to read.

Quoted 7 lines

In this case, "pcidev" can never be NULL so the check is misleading and makes the code more complicated. Removing it is a good thing. Also the attach function does not have a NULL check so when we remove this check we make the code more consistent.

But in other cases, if "pcidev" could be NULL then we should keep the check so that the code is easier to read.

Yes agree, I also sent this patch because there is only one call for pci_dev_put in adl_pci9118.c, and i thoguht its good to remove check around that one.

Thanks for your feedback. ------------ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥