staging: rtl8712: fix negative level value
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Sun, 11 Oct 2015 13:16:57 +0000 (14:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 03:43:20 +0000 (20:43 -0700)
range->avg_qual.level is of type uint8, so it shouldn't be assigned a
negative number. Assigning it 0x100 - 78, which is the equivalent
to (20 + -98) dBm when IW_QUAL_DBM is set.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c

index 57ec8dfacc8b9f7f636b24f850571d484ff75589..4e6db88e36ffae9ee4a2194d223e73fa50683992 100644 (file)
@@ -883,7 +883,7 @@ static int r8711_wx_get_range(struct net_device *dev,
        range->max_qual.updated = 7; /* Updated all three */
        range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */
        /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
-       range->avg_qual.level = 20 + -98;
+       range->avg_qual.level = 0x100 - 78;
        range->avg_qual.noise = 0;
        range->avg_qual.updated = 7; /* Updated all three */
        range->num_bitrates = RATE_COUNT;