drivers/ieee1394/ohci1394.c: function calls without effect
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 SeedPATCH 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
@@ -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,
Quoted 17 lines · Stefan Richter
ohci1394: Remove superfluous call to
free_dma_rcv_ctx, spotted by Adrian Bunk. Also remove some superfluous comments.Signed-off-by Stefan Richter <[email protected]>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 SeedQuoted 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.Signed-off-by Stefan Richter <[email protected]>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
-2free_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()thatfree_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