DMA-PPC4xx: Adjustments for three function implementations
Subsystems (2)
cover DMA-PPC4xx: Adjustments for three function implementations
From: Markus Elfring <[email protected]>
Date: Tue, 13 Feb 2018 21:16:42 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation in two functions Improve a size determination in ppc440spe_adma_alloc_chan_resources()
drivers/dma/ppc4xx/adma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.16.1
PATCH 1/2 dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
From: Markus Elfring <[email protected]>
Date: Tue, 13 Feb 2018 20:42:40 +0100
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/dma/ppc4xx/adma.c | 2 -- 1 file changed, 2 deletions(-)
drivers/dma/ppc4xx/adma.c +0 -2
@@ -4183,7 +4183,6 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev)INIT_LIST_HEAD (&ref->node);list_add_tail (&ref->node, &ppc440spe_adma_chan_list); }else { -dev_err (&ofdev->dev,"failed to allocate channel reference!\n" ); ret = -ENOMEM ; goto err_ref_alloc; }
@@ -4468,7 +4467,6 @@ static int ppc440spe_configure_raid_devices(void) ppc440spe_dma_fifo_buf =kmalloc ((DMA0_FIFO_SIZE +DMA1_FIFO_SIZE ) <<1 ,GFP_KERNEL );if (!ppc440spe_dma_fifo_buf) { -pr_err ("%s: DMA FIFO buffer allocation failed.\n" , __func__);iounmap (i2o_reg);dcr_unmap (i2o_dcr_host, dcr_len);return -ENOMEM ;
Re: [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
Quoted 1 line · SF Markus Elfring
Omit an extra message for a memory allocation failure in these functions.
[]
drivers/dma/ppc4xx/adma.c
Quoted 1 line
drivers/dma/ppc4xx/adma.c +0
-0
[]
drivers/dma/ppc4xx/adma.c static int ppc440spe_adma_probe(struct platform_device *ofdev) · line 4188
Quoted 8 lines
drivers/dma/ppc4xx/adma.c +0
-1@@ -4183,7 +4183,6 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev)INIT_LIST_HEAD (&ref->node);list_add_tail (&ref->node, &ppc440spe_adma_chan_list); }else { -dev_err (&ofdev->dev,"failed to allocate channel reference!\n" ); ret = -ENOMEM ; goto err_ref_alloc; }
Stop being mindless and think about the change
you are making.
Reverse the test and unindent the block above.
--- drivers/dma/ppc4xx/adma.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
drivers/dma/ppc4xx/adma.c +5 -6
@@ -4178,16 +4178,15 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev) } ref =kmalloc (sizeof (*ref),GFP_KERNEL ); -if (ref) { - ref->chan = &chan->common; -INIT_LIST_HEAD (&ref->node); -list_add_tail (&ref->node, &ppc440spe_adma_chan_list); - }else { -dev_err (&ofdev->dev,"failed to allocate channel reference!\n" ); +if (!ref) { ret = -ENOMEM ; goto err_ref_alloc; } + ref->chan = &chan->common; +INIT_LIST_HEAD (&ref->node); +list_add_tail (&ref->node, &ppc440spe_adma_chan_list); + ret =ppc440spe_adma_setup_irqs (adev, chan, &initcode);if (ret) goto err_irq;
PATCH 2/2 dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 13 Feb 2018 20:54:30 +0100
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
--- drivers/dma/ppc4xx/adma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ppc4xx/adma.c +1 -2
@@ -1795,8 +1795,7 @@ static int ppc440spe_adma_alloc_chan_resources(struct dma_chan *chan) db_sz =sizeof (struct xor_cb );for (; i < (ppc440spe_chan->device->pool_size / db_sz); i++) { - slot =kzalloc (sizeof (struct ppc440spe_adma_desc_slot ), -GFP_KERNEL ); + slot =kzalloc (sizeof (*slot),GFP_KERNEL );if (!slot) {printk (KERN_INFO "SPE ADMA Channel only initialized" " %d descriptor slots" , i--);