Skip to content

Commit

Permalink
[media] ddbridge: Replace vmalloc with vzalloc
Browse files Browse the repository at this point in the history
vzalloc combines vmalloc and memset 0.

The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            vmalloc
+            vzalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

Signed-off-by: Amitoj Kaur Chawla <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
musicakc authored and mchehab committed Jul 8, 2016
1 parent e95be15 commit 20634fd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/pci/ddbridge/ddbridge-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,10 +1569,9 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (pci_enable_device(pdev) < 0)
return -ENODEV;

dev = vmalloc(sizeof(struct ddb));
dev = vzalloc(sizeof(struct ddb));
if (dev == NULL)
return -ENOMEM;
memset(dev, 0, sizeof(struct ddb));

dev->pdev = pdev;
pci_set_drvdata(pdev, dev);
Expand Down

0 comments on commit 20634fd

Please sign in to comment.