mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] staging/comedi: remove unnecessary check around pci_dev_put
@ 2015-06-25 11:14 Maninder Singh
  2015-06-25 14:39 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Maninder Singh @ 2015-06-25 11:14 UTC (permalink / raw)
  To: abbotti, hsweeten, gregkh, devel, linux-kernel; +Cc: pankaj.m, Maninder Singh

pci_dev_put checks for NULL pointer itself,
reported by coccinelle

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Yogesh Gaur <yn.gaur@samsung.com>
---
v2: changelog typo cehcks -> checks

 drivers/staging/comedi/drivers/adl_pci9118.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
index fb3043d..19b5806 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1717,8 +1717,7 @@ static void pci9118_detach(struct comedi_device *dev)
 		pci9118_reset(dev);
 	comedi_pci_detach(dev);
 	pci9118_free_dma(dev);
-	if (pcidev)
-		pci_dev_put(pcidev);
+	pci_dev_put(pcidev);
 }
 
 static struct comedi_driver adl_pci9118_driver = {
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] staging/comedi: remove unnecessary check around pci_dev_put
  2015-06-25 11:14 [PATCH v2] staging/comedi: remove unnecessary check around pci_dev_put Maninder Singh
@ 2015-06-25 14:39 ` Ian Abbott
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Abbott @ 2015-06-25 14:39 UTC (permalink / raw)
  To: Maninder Singh, hsweeten, gregkh, devel, linux-kernel; +Cc: pankaj.m

On 25/06/15 12:14, Maninder Singh wrote:
> pci_dev_put checks for NULL pointer itself,
> reported by coccinelle
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> Reviewed-by: Yogesh Gaur <yn.gaur@samsung.com>
> ---
> v2: changelog typo cehcks -> checks
>
>   drivers/staging/comedi/drivers/adl_pci9118.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
> index fb3043d..19b5806 100644
> --- a/drivers/staging/comedi/drivers/adl_pci9118.c
> +++ b/drivers/staging/comedi/drivers/adl_pci9118.c
> @@ -1717,8 +1717,7 @@ static void pci9118_detach(struct comedi_device *dev)
>   		pci9118_reset(dev);
>   	comedi_pci_detach(dev);
>   	pci9118_free_dma(dev);
> -	if (pcidev)
> -		pci_dev_put(pcidev);
> +	pci_dev_put(pcidev);
>   }
>
>   static struct comedi_driver adl_pci9118_driver = {
>

The patch does no harm, but as mentioned by Dan Carpenter, if pcidev 
could be NULL (which it could be), we should keep the test for readability.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-25 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 11:14 [PATCH v2] staging/comedi: remove unnecessary check around pci_dev_put Maninder Singh
2015-06-25 14:39 ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®