staging: rtl8192e: rtl_wx: fix negative noise value
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Wed, 30 Sep 2015 12:12:11 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Oct 2015 09:48:15 +0000 (11:48 +0200)
wstats->qual.noise is of type uint8, so it shouldn't be assigned a
negative number. Assigning it 0x100 - 100, which is the equivalent
to -100 dBm when IW_QUAL_DBM is set.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c

index 984cb9a0abaed2e6f3d9dec5fff8099cec6caf77..70df6a1485d6fb0e0a05fff203b4f92d41fe2ec0 100644 (file)
@@ -1225,7 +1225,7 @@ static struct iw_statistics *_rtl92e_get_wireless_stats(struct net_device *dev)
        if (ieee->state < RTLLIB_LINKED) {
                wstats->qual.qual = 10;
                wstats->qual.level = 0;
-               wstats->qual.noise = -100;
+               wstats->qual.noise = 0x100 - 100;       /* -100 dBm */
                wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
                return wstats;
        }