staging: r8188eu: Fix smatch warning in os_dep/osdep_service.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 4 Sep 2013 20:56:00 +0000 (15:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:45 +0000 (07:47 -0700)
Smatch reports the following warning:
drivers/staging/rtl8188eu/os_dep/osdep_service.c:634 rtw_change_ifname() warn: variable dereferenced before check 'padapter' (see line 630)

The dereference in question is deferred until the validity of 'padapter' is verified.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/os_dep/osdep_service.c

index 4e0bfb7e153b811b75227b9d864b96d49f48676c..51a1f6f9dbe78ec1be32a8b7e5012a2d7e10cf3c 100644 (file)
@@ -627,13 +627,14 @@ RETURN:
 int rtw_change_ifname(struct adapter *padapter, const char *ifname)
 {
        struct net_device *pnetdev;
-       struct net_device *cur_pnetdev = padapter->pnetdev;
+       struct net_device *cur_pnetdev;
        struct rereg_nd_name_data *rereg_priv;
        int ret;
 
        if (!padapter)
                goto error;
 
+       cur_pnetdev = padapter->pnetdev;
        rereg_priv = &padapter->rereg_nd_name_priv;
 
        /* free the old_pnetdev */