* [PATCH 0/2] DMA-PPC4xx: Adjustments for three function implementations
@ 2018-02-13 20:23 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:23 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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(-)
--
2.16.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 0/2] DMA-PPC4xx: Adjustments for three function implementations
@ 2018-02-13 20:23 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:23 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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(-)
--
2.16.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
2018-02-13 20:23 ` SF Markus Elfring
(?)
@ 2018-02-13 20:25 ` SF Markus Elfring
-1 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:25 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..f4033367d59b 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
@ 2018-02-13 20:25 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:25 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..f4033367d59b 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
@ 2018-02-13 20:25 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:25 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..f4033367d59b 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources()
2018-02-13 20:23 ` SF Markus Elfring
(?)
@ 2018-02-13 20:26 ` SF Markus Elfring
-1 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:26 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index f4033367d59b..27ea48a2c1dc 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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--);
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources()
@ 2018-02-13 20:26 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:26 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index f4033367d59b..27ea48a2c1dc 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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--);
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources()
@ 2018-02-13 20:26 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-02-13 20:26 UTC (permalink / raw)
To: dmaengine, Dan Williams, Greg Kroah-Hartman, Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index f4033367d59b..27ea48a2c1dc 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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--);
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
2018-02-13 20:25 ` SF Markus Elfring
(?)
@ 2018-02-13 20:40 ` Joe Perches
-1 siblings, 0 replies; 11+ messages in thread
From: Joe Perches @ 2018-02-13 20:40 UTC (permalink / raw)
To: SF Markus Elfring, dmaengine, Dan Williams, Greg Kroah-Hartman,
Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
On Tue, 2018-02-13 at 21:25 +0100, SF Markus Elfring wrote:
> Omit an extra message for a memory allocation failure in these functions.
[]
> diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
[]
> @@ -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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..1fc1a2f03aa4 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
@ 2018-02-13 20:40 ` Joe Perches
0 siblings, 0 replies; 11+ messages in thread
From: Joe Perches @ 2018-02-13 20:40 UTC (permalink / raw)
To: SF Markus Elfring, dmaengine, Dan Williams, Greg Kroah-Hartman,
Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
On Tue, 2018-02-13 at 21:25 +0100, SF Markus Elfring wrote:
> Omit an extra message for a memory allocation failure in these functions.
[]
> diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
[]
> @@ -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(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..1fc1a2f03aa4 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
@ 2018-02-13 20:40 ` Joe Perches
0 siblings, 0 replies; 11+ messages in thread
From: Joe Perches @ 2018-02-13 20:40 UTC (permalink / raw)
To: SF Markus Elfring, dmaengine, Dan Williams, Greg Kroah-Hartman,
Rob Herring, Vinod Koul
Cc: LKML, kernel-janitors
On Tue, 2018-02-13 at 21:25 +0100, SF Markus Elfring wrote:
> Omit an extra message for a memory allocation failure in these functions.
[]
> diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
[]
> @@ -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(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 4cf0d4d0cecf..1fc1a2f03aa4 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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;
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-02-13 20:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 20:26 [2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources() SF Markus Elfring
2018-02-13 20:26 ` [PATCH 2/2] " SF Markus Elfring
2018-02-13 20:26 ` SF Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2018-02-13 20:40 [1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions Joe Perches
2018-02-13 20:40 ` [PATCH 1/2] " Joe Perches
2018-02-13 20:40 ` Joe Perches
2018-02-13 20:25 [1/2] " SF Markus Elfring
2018-02-13 20:25 ` [PATCH 1/2] " SF Markus Elfring
2018-02-13 20:25 ` SF Markus Elfring
2018-02-13 20:23 [PATCH 0/2] DMA-PPC4xx: Adjustments for three function implementations SF Markus Elfring
2018-02-13 20:23 ` SF Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.