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: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] video: sm501fb: Improve a size determination in sm501fb_probe()
Date: Sun, 26 Nov 2017 10:18:26 +0000	[thread overview]
Message-ID: <08ed1e90-5714-04b7-b3dc-067a3d9bc38b@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:22:37 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/video/fbdev/sm501fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index e8301c4e7d44..80bda5a655c0 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1932,8 +1932,7 @@ static int sm501fb_probe(struct platform_device *pdev)
 	int ret;
 
 	/* allocate our framebuffers */
-
-	info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
-- 
2.15.0


  parent reply	other threads:[~2017-11-26 10:18 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 ` [PATCH 1/4] video: sm501fb: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
2017-11-26 10:18 ` SF Markus Elfring [this message]
2018-04-26 10:15   ` [PATCH 2/4] video: sm501fb: Improve a size determination in sm501fb_probe() 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=08ed1e90-5714-04b7-b3dc-067a3d9bc38b@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).