]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
target: Improve size determinations in two functions
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 9 Apr 2017 18:15:12 +0000 (20:15 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 2 May 2017 05:21:30 +0000 (22:21 -0700)
Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determinations a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_rd.c

index 838dc128d494ca65593ec4d6592253916a6c22f8..20253d04103f6442e4aa5932b67dd88a7251520c 100644 (file)
@@ -47,7 +47,7 @@ static int rd_attach_hba(struct se_hba *hba, u32 host_id)
 {
        struct rd_host *rd_host;
 
-       rd_host = kzalloc(sizeof(struct rd_host), GFP_KERNEL);
+       rd_host = kzalloc(sizeof(*rd_host), GFP_KERNEL);
        if (!rd_host)
                return -ENOMEM;
 
@@ -285,7 +285,7 @@ static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name)
        struct rd_dev *rd_dev;
        struct rd_host *rd_host = hba->hba_ptr;
 
-       rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL);
+       rd_dev = kzalloc(sizeof(*rd_dev), GFP_KERNEL);
        if (!rd_dev)
                return NULL;