Re: [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions
From: Joe Perches
Date: Tue Feb 13 2018 - 15:40:41 EST
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;