]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
spi/topcliff-pch: Improve size determinations in pch_spi_probe()
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 13 Jan 2017 14:46:35 +0000 (15:46 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 17 Jan 2017 18:35:06 +0000 (18:35 +0000)
Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-topcliff-pch.c

index 1beeb16e836a14dbe55788e3a9da21137433edf0..0a876311b67bc05da521b018826f74894258e8c0 100644 (file)
@@ -1539,11 +1539,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        int i;
        struct pch_pd_dev_save *pd_dev_save;
 
-       pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL);
+       pd_dev_save = kzalloc(sizeof(*pd_dev_save), GFP_KERNEL);
        if (!pd_dev_save)
                return -ENOMEM;
 
-       board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL);
+       board_dat = kzalloc(sizeof(*board_dat), GFP_KERNEL);
        if (!board_dat) {
                retval = -ENOMEM;
                goto err_no_mem;