public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/ieee1394/ohci1394.c: function calls without effect
@ 2006-03-09 11:41 Adrian Bunk
  2006-03-09 13:18 ` [PATCH] " Stefan Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2006-03-09 11:41 UTC (permalink / raw)
  To: bcollins, scjody; +Cc: linux1394-devel, linux-kernel

While investigating two (incorrect) errors of the Coverity checker, I 
found the following in drivers/ieee1394/ohci1394.c:ohci1394_pci_remove():

                /* Free IR dma */
                free_dma_rcv_ctx(&ohci->ir_legacy_context);

                /* Free IT dma */
                free_dma_trm_ctx(&ohci->it_legacy_context);

                /* Free IR legacy dma */
                free_dma_rcv_ctx(&ohci->ir_legacy_context);


Both functions contain:


<--  snip  -->

static void free_dma_rcv_ctx(struct dma_rcv_ctx *d)
{
        int i;
        struct ti_ohci *ohci = d->ohci;

        if (ohci == NULL)
                return;
...
        /* Mark this context as freed. */
        d->ohci = NULL;
}

<--  snip  -->


There are no other return possibilities in these functions.


Therefore, the latter two of the three function calls above aren't doing 
anything.


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* [PATCH] drivers/ieee1394/ohci1394.c: function calls without effect
  2006-03-09 11:41 drivers/ieee1394/ohci1394.c: function calls without effect Adrian Bunk
@ 2006-03-09 13:18 ` Stefan Richter
  2006-03-09 13:51   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Richter @ 2006-03-09 13:18 UTC (permalink / raw)
  To: linux1394-devel; +Cc: Adrian Bunk, bcollins, scjody, linux-kernel

ohci1394: Remove superfluous call to free_dma_rcv_ctx,
spotted by Adrian Bunk. Also remove some superfluous comments.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

Index: linux/drivers/ieee1394/ohci1394.c
===================================================================
--- linux.orig/drivers/ieee1394/ohci1394.c     2006-03-06 20:04:10.000000000 +0100
+++ linux/drivers/ieee1394/ohci1394.c  2006-03-09 14:09:21.000000000 +0100
@@ -3462,24 +3462,13 @@ static void ohci1394_pci_remove(struct p
 	case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE:
 		/* The ohci_soft_reset() stops all DMA contexts, so we
 		 * dont need to do this.  */
-		/* Free AR dma */
 		free_dma_rcv_ctx(&ohci->ar_req_context);
 		free_dma_rcv_ctx(&ohci->ar_resp_context);
-
-		/* Free AT dma */
 		free_dma_trm_ctx(&ohci->at_req_context);
 		free_dma_trm_ctx(&ohci->at_resp_context);
-
-		/* Free IR dma */
 		free_dma_rcv_ctx(&ohci->ir_legacy_context);
-
-		/* Free IT dma */
 		free_dma_trm_ctx(&ohci->it_legacy_context);
 
-		/* Free IR legacy dma */
-		free_dma_rcv_ctx(&ohci->ir_legacy_context);
-
-
 	case OHCI_INIT_HAVE_SELFID_BUFFER:
 		pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
 				    ohci->selfid_buf_cpu,



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

* Re: [PATCH] drivers/ieee1394/ohci1394.c: function calls without effect
  2006-03-09 13:18 ` [PATCH] " Stefan Richter
@ 2006-03-09 13:51   ` Adrian Bunk
  2006-03-09 14:06     ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2006-03-09 13:51 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux1394-devel, bcollins, scjody, linux-kernel

On Thu, Mar 09, 2006 at 02:18:28PM +0100, Stefan Richter wrote:
> ohci1394: Remove superfluous call to free_dma_rcv_ctx,
> spotted by Adrian Bunk. Also remove some superfluous comments.
> 
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> 
> Index: linux/drivers/ieee1394/ohci1394.c
> ===================================================================
> --- linux.orig/drivers/ieee1394/ohci1394.c     2006-03-06 20:04:10.000000000 +0100
> +++ linux/drivers/ieee1394/ohci1394.c  2006-03-09 14:09:21.000000000 +0100
> @@ -3462,24 +3462,13 @@ static void ohci1394_pci_remove(struct p
>  	case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE:
>  		/* The ohci_soft_reset() stops all DMA contexts, so we
>  		 * dont need to do this.  */
> -		/* Free AR dma */
>  		free_dma_rcv_ctx(&ohci->ar_req_context);
>  		free_dma_rcv_ctx(&ohci->ar_resp_context);
> -
> -		/* Free AT dma */
>  		free_dma_trm_ctx(&ohci->at_req_context);
>  		free_dma_trm_ctx(&ohci->at_resp_context);
> -
> -		/* Free IR dma */
>  		free_dma_rcv_ctx(&ohci->ir_legacy_context);
> -
> -		/* Free IT dma */
>  		free_dma_trm_ctx(&ohci->it_legacy_context);
>...

Unless I'm mireading the code, it's impossible after the call of 
free_dma_rcv_ctx() that free_dma_trm_ctx() will do anything.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] drivers/ieee1394/ohci1394.c: function calls without effect
  2006-03-09 13:51   ` Adrian Bunk
@ 2006-03-09 14:06     ` Adrian Bunk
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2006-03-09 14:06 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux1394-devel, bcollins, scjody, linux-kernel

On Thu, Mar 09, 2006 at 02:51:00PM +0100, Adrian Bunk wrote:
> On Thu, Mar 09, 2006 at 02:18:28PM +0100, Stefan Richter wrote:
> > ohci1394: Remove superfluous call to free_dma_rcv_ctx,
> > spotted by Adrian Bunk. Also remove some superfluous comments.
> > 
> > Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> > 
> > Index: linux/drivers/ieee1394/ohci1394.c
> > ===================================================================
> > --- linux.orig/drivers/ieee1394/ohci1394.c     2006-03-06 20:04:10.000000000 +0100
> > +++ linux/drivers/ieee1394/ohci1394.c  2006-03-09 14:09:21.000000000 +0100
> > @@ -3462,24 +3462,13 @@ static void ohci1394_pci_remove(struct p
> >  	case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE:
> >  		/* The ohci_soft_reset() stops all DMA contexts, so we
> >  		 * dont need to do this.  */
> > -		/* Free AR dma */
> >  		free_dma_rcv_ctx(&ohci->ar_req_context);
> >  		free_dma_rcv_ctx(&ohci->ar_resp_context);
> > -
> > -		/* Free AT dma */
> >  		free_dma_trm_ctx(&ohci->at_req_context);
> >  		free_dma_trm_ctx(&ohci->at_resp_context);
> > -
> > -		/* Free IR dma */
> >  		free_dma_rcv_ctx(&ohci->ir_legacy_context);
> > -
> > -		/* Free IT dma */
> >  		free_dma_trm_ctx(&ohci->it_legacy_context);
> >...
> 
> Unless I'm mireading the code, it's impossible after the call of 
> free_dma_rcv_ctx() that free_dma_trm_ctx() will do anything.

Skip this, Ben already explained to me that an r (ir_) isn't a t (it_).

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

end of thread, other threads:[~2006-03-09 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-09 11:41 drivers/ieee1394/ohci1394.c: function calls without effect Adrian Bunk
2006-03-09 13:18 ` [PATCH] " Stefan Richter
2006-03-09 13:51   ` Adrian Bunk
2006-03-09 14:06     ` Adrian Bunk

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