linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] misc/lattice-ecp3-config: Delete an error message for a failed memory allocation in two functions
Date: Mon, 8 Jan 2018 18:09:36 +0100	[thread overview]
Message-ID: <293c6ae3-7b1e-690c-7ac0-352dee270e32@users.sourceforge.net> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 18:01:39 +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/misc/lattice-ecp3-config.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c
index 626fdcaf2510..8aa60907ced4 100644
--- a/drivers/misc/lattice-ecp3-config.c
+++ b/drivers/misc/lattice-ecp3-config.c
@@ -119,10 +119,8 @@ static void firmware_load(const struct firmware *fw, void *context)
 	dev_dbg(&spi->dev, "FPGA Status=%08x\n", status);
 
 	buffer = kzalloc(fw->size + 8, GFP_KERNEL);
-	if (!buffer) {
-		dev_err(&spi->dev, "Error: Can't allocate memory!\n");
+	if (!buffer)
 		return;
-	}
 
 	/*
 	 * Insert WRITE_INC command into stream (one SPI frame)
@@ -196,10 +194,9 @@ static int lattice_ecp3_probe(struct spi_device *spi)
 	int err;
 
 	data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL);
-	if (!data) {
-		dev_err(&spi->dev, "Memory allocation for fpga_data failed\n");
+	if (!data)
 		return -ENOMEM;
-	}
+
 	spi_set_drvdata(spi, data);
 
 	init_completion(&data->fw_loaded);
-- 
2.15.1

                 reply	other threads:[~2018-01-08 17:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=293c6ae3-7b1e-690c-7ac0-352dee270e32@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).