Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1738133

[PATCH 2/6] [media] omap_vout: Improve a size determination in two functions

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/6] [media] omap_vout: Improve a size determination in two functions
Date 2017-09-24 12:30 +0200
Message-ID <utckF-7vc-11@gated-at.bofh.it> (permalink)
References <utckF-7vc-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 10:18:26 +0200

Replace the specification of data structures by variable references
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/media/platform/omap/omap_vout.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index aebc1e628ac5..4a4d171ca573 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1943,8 +1943,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
 			struct omap2video_device, v4l2_dev);
 
 	for (k = 0; k < pdev->num_resources; k++) {
-
-		vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL);
+		vout = kzalloc(sizeof(*vout), GFP_KERNEL);
 		if (!vout)
 			return -ENOMEM;
 
@@ -2095,7 +2094,7 @@ static int __init omap_vout_probe(struct platform_device *pdev)
 		goto err_dss_init;
 	}
 
-	vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL);
+	vid_dev = kzalloc(sizeof(*vid_dev), GFP_KERNEL);
 	if (vid_dev == NULL) {
 		ret = -ENOMEM;
 		goto err_dss_init;
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] [media] omap_vout: Adjustments for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
  [PATCH 1/6] [media] omap_vout: Delete an error message for a failed  memory allocation in omap_vout_create_video_devices() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
    Re: [PATCH 1/6] [media] omap_vout: Delete an error message for a  failed memory allocation in omap_vout_create_video_devices() Joe Perches <joe@perches.com> - 2017-09-24 12:40 +0200
  [PATCH 3/6] [media] omap_vout: Adjust a null pointer check in two  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
  [PATCH 2/6] [media] omap_vout: Improve a size determination in two  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
  [PATCH 6/6] [media] omap_vout: Delete two unnecessary variable  initialisations in omap_vout_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:40 +0200
  [PATCH 5/6] [media] omap_vout: Delete an unnecessary variable  initialisation in omap_vout_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:40 +0200

csiph-web