Skip to contentSkip to conversation

drivers/ieee1394/ohci1394.c: function calls without effect

PATCH In review Adrian Bunk 2 participants 4 messages Mar 9, 2006

lore
Share & tools
lore
#0 lore raw

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

Signature · 4 lines
       "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
#1 lore raw

PATCH 1/1 drivers/ieee1394/ohci1394.c: function calls without effect

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

drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 renamed from drivers/ieee1394/ohci1394.c 2006-03-06 20:04:10.000000000 +0100 +0 -11
Index: linux/drivers/ieee1394/ohci1394.c
===================================================================
@@ -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,
#2 lore raw
Quoted 17 lines · Stefan Richter

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

Index: linux/drivers/ieee1394/ohci1394.c
===================================================================

drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 renamed from drivers/ieee1394/ohci1394.c 2006-03-06 20:04:10.000000000 +0100 +0 -2
@@ -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);
-

drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 static void ohci1394_pci_remove(struct p · line 3470

Quoted 10 lines
drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 renamed from drivers/ieee1394/ohci1394.c 2006-03-06 20:04:10.000000000 +0100 +0 -5
-		/* 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

Signature · 4 lines
       "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
#3 lore raw
Quoted 23 lines · Adrian Bunk
Quoted 22 lines · Stefan Richter

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

Index: linux/drivers/ieee1394/ohci1394.c
===================================================================

drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 renamed from drivers/ieee1394/ohci1394.c 2006-03-06 20:04:10.000000000 +0100 +0 -5
@@ -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 */
Quoted 8 lines

drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 static void ohci1394_pci_remove(struct p · line 3470

Quoted 5 lines
drivers/ieee1394/ohci1394.c 2006-03-09 14:09:21.000000000 +0100 renamed from drivers/ieee1394/ohci1394.c 2006-03-06 20:04:10.000000000 +0100 +0 -2
 		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

Signature · 4 lines
       "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