Re: [PATCH] watchdog: cpwd: remove memory allocate failure message

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

 



On 12/04/2016 01:22 PM, akkushwaha9896@xxxxxxxxx wrote:
From: Amit Kushwaha <akkushwaha9896@xxxxxxxxx>

This patch cleanup following warning reported by checkpatch.pl
WARNING: Possible unnecessary 'out of memory' message
With no available memory, a warn on message already gets printed
by page alloc functions

Signed-off-by: Amit Kushwaha <akkushwaha9896@xxxxxxxxx>
---
 drivers/watchdog/cpwd.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index 71ee079..baa2d0d 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -540,10 +540,8 @@ static int cpwd_probe(struct platform_device *op)

 	p = kzalloc(sizeof(*p), GFP_KERNEL);
 	err = -ENOMEM;
-	if (!p) {
-		pr_err("Unable to allocate struct cpwd\n");
+	if (!p)
 		goto out;
-	}

If you look closely, that goto is quite useless and should be replaced with
a direct return statement Plus, replacing the kzalloc() with devm_kzalloc()
and dropping the kfree() calls would be much more valuable.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux