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


Groups > linux.kernel > #1725580

[PATCH 2/7] [media] Hopper: Improve a size determination in hopper_pci_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/7] [media] Hopper: Improve a size determination in hopper_pci_probe()
Date 2017-09-02 22:50 +0200
Message-ID <ulnwC-7AM-15@gated-at.bofh.it> (permalink)
References <ulnwC-7AM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 21:21:22 +0200

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/media/pci/mantis/hopper_cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mantis/hopper_cards.c b/drivers/media/pci/mantis/hopper_cards.c
index cc1bb04d8cb4..fe7b40c306f7 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -163,7 +163,7 @@ static int hopper_pci_probe(struct pci_dev *pdev,
 	struct mantis_hwconfig *config;
 	int err = 0;
 
-	mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+	mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
 	if (mantis == NULL) {
 		err = -ENOMEM;
 		goto fail0;
-- 
2.14.1

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


Thread

[PATCH 0/7] [media] Mantis: Adjustments for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 22:50 +0200
  [PATCH 6/7] [media] Mantis: Improve a size determination in  mantis_pci_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 22:50 +0200
  [PATCH 2/7] [media] Hopper: Improve a size determination in  hopper_pci_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 22:50 +0200
  [PATCH 4/7] [media] Hopper: Delete an unnecessary variable  initialisation in hopper_pci_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 22:50 +0200

csiph-web