linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Bhumika Goyal <bhumirks@gmail.com>,
	Colin Ian King <colin.king@canonical.com>,
	"Gustavo A. R. Silva" <garsilva@embeddedor.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/4] video: sm501fb: Delete error messages for a failed memory allocation in two functions
Date: Sun, 26 Nov 2017 10:17:25 +0000	[thread overview]
Message-ID: <8d053c52-e3e6-32fe-87e9-f01a779b497e@users.sourceforge.net> (raw)
In-Reply-To: <efb981db-e9a0-d6f7-00d4-c76e1162770c@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Nov 2017 10:10:31 +0100

Omit extra messages 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/video/fbdev/sm501fb.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 6f0a19501c6a..e8301c4e7d44 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1934,10 +1934,8 @@ static int sm501fb_probe(struct platform_device *pdev)
 	/* allocate our framebuffers */
 
 	info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL);
-	if (!info) {
-		dev_err(dev, "failed to allocate state\n");
+	if (!info)
 		return -ENOMEM;
-	}
 
 	info->dev = dev = &pdev->dev;
 	platform_set_drvdata(pdev, info);
@@ -2121,16 +2119,12 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
 	/* backup copies in case chip is powered down over suspend */
 
 	par->store_fb = vmalloc(par->screen.size);
-	if (par->store_fb = NULL) {
-		dev_err(info->dev, "no memory to store screen\n");
+	if (!par->store_fb)
 		return -ENOMEM;
-	}
 
 	par->store_cursor = vmalloc(par->cursor.size);
-	if (par->store_cursor = NULL) {
-		dev_err(info->dev, "no memory to store cursor\n");
+	if (!par->store_cursor)
 		goto err_nocursor;
-	}
 
 	dev_dbg(info->dev, "suspending screen to %p\n", par->store_fb);
 	dev_dbg(info->dev, "suspending cursor to %p\n", par->store_cursor);
-- 
2.15.0


  reply	other threads:[~2017-11-26 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 10:16 [PATCH 0/4] video: sm501fb: Adjustments for seven function implementations SF Markus Elfring
2017-11-26 10:17 ` SF Markus Elfring [this message]
2017-11-26 10:18 ` [PATCH 2/4] video: sm501fb: Improve a size determination in sm501fb_probe() SF Markus Elfring
2018-04-26 10:15   ` Bartlomiej Zolnierkiewicz
2017-11-26 10:19 ` [PATCH 3/4] video: sm501fb: Combine substrings for four messages SF Markus Elfring
2017-11-26 10:22 ` [PATCH 4/4] video: sm501fb: Adjust 15 checks for null pointers SF Markus Elfring

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=8d053c52-e3e6-32fe-87e9-f01a779b497e@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=b.zolnierkie@samsung.com \
    --cc=bhumirks@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=garsilva@embeddedor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /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).