Re: [bug report] staging: ks7010: add driver from Nanonote extra-repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 28, 2017 at 04:41:33PM +0300, Dan Carpenter wrote:

Adding Tobin to CC, he is way more into the driver than I am these
days...

> Hello Wolfram Sang,
> 
> The patch 13a9930d15b4: "staging: ks7010: add driver from Nanonote
> extra-repository" from May 31, 2016, leads to the following static
> checker warning:
> 
> 	drivers/staging/ks7010/ks_wlan_net.c:1141 ks_wlan_get_range()
> 	warn: dead code because of 'i > 2' and 'i < 13'
> 
> drivers/staging/ks7010/ks_wlan_net.c
>   1062  static int ks_wlan_get_range(struct net_device *dev,
>   1063                               struct iw_request_info *info,
>   1064                               struct iw_point *dwrq, char *extra)
>   1065  {
>   1066          struct ks_wlan_private *priv =
>   1067              (struct ks_wlan_private *)netdev_priv(dev);
>   1068          struct iw_range *range = (struct iw_range *)extra;
>   1069          int i, k;
>   1070  
>   1071          DPRINTK(2, "\n");
>   1072  
>   1073          if (priv->sleep_mode == SLP_SLEEP)
>   1074                  return -EPERM;
>   1075  
>   1076          /* for SLEEP MODE */
>   1077          dwrq->length = sizeof(struct iw_range);
>   1078          memset(range, 0, sizeof(*range));
>   1079          range->min_nwid = 0x0000;
>   1080          range->max_nwid = 0x0000;
>   1081          range->num_channels = 14;
>   1082          /* Should be based on cap_rid.country to give only
>   1083           * what the current card support
>   1084           */
>   1085          k = 0;
>   1086          for (i = 0; i < 13; i++) {      /* channel 1 -- 13 */
>                             ^^^^^^
>   1087                  range->freq[k].i = i + 1;       /* List index */
>   1088                  range->freq[k].m = frequency_list[i] * 100000;
>   1089                  range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
>   1090          }
> 
> i is always 13 after the loop.
> 
>   1091          range->num_frequency = k;
>   1092          if (priv->reg.phy_type == D_11B_ONLY_MODE || priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) {    /* channel 14 */
>   1093                  range->freq[13].i = 14; /* List index */
>   1094                  range->freq[13].m = frequency_list[13] * 100000;
>   1095                  range->freq[13].e = 1;  /* Values in table in MHz -> * 10^5 * 10 */
>   1096                  range->num_frequency = 14;
>   1097          }
>   1098  
>   1099          /* Hum... Should put the right values there */
>   1100          range->max_qual.qual = 100;
>   1101          range->max_qual.level = 256 - 128;      /* 0 dBm? */
>   1102          range->max_qual.noise = 256 - 128;
>   1103          range->sensitivity = 1;
>   1104  
>   1105          if (priv->reg.phy_type == D_11B_ONLY_MODE) {
>   1106                  range->bitrate[0] = 1e6;
>   1107                  range->bitrate[1] = 2e6;
>   1108                  range->bitrate[2] = 5.5e6;
>   1109                  range->bitrate[3] = 11e6;
>   1110                  range->num_bitrates = 4;
>   1111          } else {        /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
>   1112                  range->bitrate[0] = 1e6;
>   1113                  range->bitrate[1] = 2e6;
>   1114                  range->bitrate[2] = 5.5e6;
>   1115                  range->bitrate[3] = 11e6;
>   1116  
>   1117                  range->bitrate[4] = 6e6;
>   1118                  range->bitrate[5] = 9e6;
>   1119                  range->bitrate[6] = 12e6;
>   1120                  if (IW_MAX_BITRATES < 9) {
>   1121                          range->bitrate[7] = 54e6;
>   1122                          range->num_bitrates = 8;
>   1123                  } else {
>   1124                          range->bitrate[7] = 18e6;
>   1125                          range->bitrate[8] = 24e6;
>   1126                          range->bitrate[9] = 36e6;
>   1127                          range->bitrate[10] = 48e6;
>   1128                          range->bitrate[11] = 54e6;
>   1129  
>   1130                          range->num_bitrates = 12;
>   1131                  }
>   1132          }
>   1133  
>   1134          /* Set an indication of the max TCP throughput
>   1135           * in bit/s that we can expect using this interface.
>   1136           * May be use for QoS stuff... Jean II
>   1137           */
>   1138          if (i > 2)
>                     ^^^^^
> So this condition is always true.  I'm not sure what was intended,
> though.
> 
>   1139                  range->throughput = 5000 * 1000;
>   1140          else
>   1141                  range->throughput = 1500 * 1000;
>   1142  
> 
> regards,
> dan carpenter

Attachment: signature.asc
Description: PGP signature

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux