]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: Use sizeof type *pointer instead of sizeof type
authorsayli karnik <karniksayli1995@gmail.com>
Fri, 16 Sep 2016 10:53:02 +0000 (16:23 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Sep 2016 21:32:13 +0000 (23:32 +0200)
The patch uses the size of the dereference to a variable instead of it's type,
to make the code more resistant to type changes in the future. The type of the
pointer variable here is the same as the type in the argument that is being
replaced in sizeof().

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c

index 78f524fcd2142dd486d20aba5fe75f461cc5f466..d0cb568c94b18b46e312ab02239201ece11481d3 100644 (file)
@@ -3329,7 +3329,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 
        init_completion(&hif_wait_response);
 
-       hif_drv  = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL);
+       hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
        if (!hif_drv) {
                result = -ENOMEM;
                goto _fail_;
@@ -3878,7 +3878,7 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
        pu8IEs = ptstrNetworkInfo->ies;
        u16IEsLen = ptstrNetworkInfo->ies_len;
 
-       pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL);
+       pNewJoinBssParam = kzalloc(sizeof(*pNewJoinBssParam), GFP_KERNEL);
        if (pNewJoinBssParam) {
                pNewJoinBssParam->dtim_period = ptstrNetworkInfo->dtim_period;
                pNewJoinBssParam->beacon_period = ptstrNetworkInfo->beacon_period;