Re: [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux