Staging: otus: Add null check and fix coding style issue
authorPeter Huewe <peterhuewe@gmx.de>
Mon, 26 Apr 2010 22:34:49 +0000 (00:34 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:35:43 +0000 (11:35 -0700)
This patch removes mixing of declarations and code and adds a null-test
after a kmalloc.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/otus/ioctl.c

index b9dd943e07a18c55b8bcd435646b476dfbaea0e2..a48c8e4a9ea769d91d054ae2f9206c7f1ade996c 100644 (file)
@@ -867,6 +867,7 @@ int usbdrvwext_giwscan(struct net_device *dev,
        char *current_ev = extra;
        char *end_buf;
        int i;
+       struct zsBssListV1 *pBssList;
        /* BssList = wd->sta.pBssList; */
        /* zmw_get_wlan_dev(dev); */
 
@@ -874,8 +875,10 @@ int usbdrvwext_giwscan(struct net_device *dev,
                return 0;
 
        /* struct zsBssList BssList; */
-       struct zsBssListV1 *pBssList = kmalloc(sizeof(struct zsBssListV1),
-                                                               GFP_KERNEL);
+       pBssList = kmalloc(sizeof(struct zsBssListV1), GFP_KERNEL);
+       if (pBssList == NULL)
+               return -ENOMEM;
+
        if (data->length == 0)
                end_buf = extra + IW_SCAN_MAX_DATA;
        else