Staging: rtl8188eu: Fix warning of unchecked sscanf return value.
authorElena Oat <oat.elena@gmail.com>
Tue, 18 Mar 2014 17:16:49 +0000 (19:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Mar 2014 19:22:21 +0000 (12:22 -0700)
This patch fixes the warning "unchecked sscanf return value" in file
rtw_mp.c. Zero is returned in case sscanf fails or if less than expected
items are read and assigned successfully. I have decided to return zero,
because in previous conditional statements zero was returned in case of
failure.

While at it, I have also fixed the warning of line over 80
characters.

Signed-off-by: Elena Oat <oat.elena@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_mp.c

index 2e02b2063c20ced683b7dc2f5d1c91d9c1fcb06e..705f666bca6b2cecbd9cf667455ee7cd3413ff0e 100644 (file)
@@ -883,7 +883,7 @@ u32 mp_query_psd(struct adapter *pAdapter, u8 *data)
 {
        u32 i, psd_pts = 0, psd_start = 0, psd_stop = 0;
        u32 psd_data = 0;
-
+       int ret;
 
        if (!netif_running(pAdapter->pnetdev)) {
                RT_TRACE(_module_mp_, _drv_warning_, ("mp_query_psd: Fail! interface not opened!\n"));
@@ -900,7 +900,10 @@ u32 mp_query_psd(struct adapter *pAdapter, u8 *data)
                psd_start = 64;
                psd_stop = 128;
        } else {
-               sscanf(data, "pts =%d, start =%d, stop =%d", &psd_pts, &psd_start, &psd_stop);
+               ret = sscanf(data, "pts =%d, start =%d, stop =%d",
+                               &psd_pts, &psd_start, &psd_stop);
+               if (ret != 3)
+                       return 0;
        }
 
        _rtw_memset(data, '\0', sizeof(*data));