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


Groups > linux.kernel > #1735919

[PATCH 3/5] [media] s2255drv: Improve two size determinations in s2255_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/5] [media] s2255drv: Improve two size determinations in s2255_probe()
Date 2017-09-20 19:10 +0200
Message-ID <urQFz-5Wh-9@gated-at.bofh.it> (permalink)
References <urQvT-5Dp-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 20 Sep 2017 16:56:20 +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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/s2255/s2255drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index aee83bf6fa94..29bc73ad7d8a 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -2237,4 +2237,4 @@ static int s2255_probe(struct usb_interface *interface,
 	/* allocate memory for our device state and initialize it to zero */
-	dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL);
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;
@@ -2247,4 +2247,4 @@ static int s2255_probe(struct usb_interface *interface,
 	dev->pid = id->idProduct;
-	dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL);
+	dev->fw_data = kzalloc(sizeof(*dev->fw_data), GFP_KERNEL);
 	if (!dev->fw_data)
 		goto errorFWDATA1;
-- 
2.14.1

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


Thread

[PATCH 0/5] [media] s2255drv: Fine-tuning for some function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:00 +0200
  [PATCH 2/5] [media] s2255drv: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:00 +0200
    Re: [PATCH 2/5] [media] s2255drv: Adjust 13 checks for null pointers Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-21 01:10 +0200
      Re: [media] s2255drv: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-21 10:20 +0200
        Re: [media] s2255drv: Adjust 13 checks for null pointers Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-21 11:30 +0200
          Re: [media] s2255drv: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-21 13:30 +0200
  [PATCH 1/5] [media] s2255drv: Delete three error messages for a  failed memory allocation in s2255_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:00 +0200
  [PATCH 4/5] [media] s2255drv: Use common error handling code in  read_pipe_completion() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:10 +0200
  [PATCH 3/5] [media] s2255drv: Improve two size determinations in  s2255_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:10 +0200
  [PATCH 5/5] [media] s2255drv: Delete an unnecessary return statement  in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-20 19:10 +0200

csiph-web