]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
staging: wilc1000: Fix problem with wrong vif index
authorAditya Shankar <aditya.shankar@microchip.com>
Fri, 7 Apr 2017 11:54:58 +0000 (17:24 +0530)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 20 Jun 2017 08:50:14 +0000 (10:50 +0200)
commit63673b234da5cddc78d06222d9a146495031c061
treee2019f05cb59053f98a0ace1fc768d438359b316
parentdb9a580faa87c781fc8b7c83277ca78fe45dd6f7
staging: wilc1000: Fix problem with wrong vif index

BugLink: http://bugs.launchpad.net/bugs/1692898
commit 0e490657c7214cce33fbca3d88227298c5c968ae upstream.

The vif->idx value is always 0 for two interfaces.

wl->vif_num = 0;

loop {
     ...

     vif->idx = wl->vif_num;
     ...
     wl->vif_num = i;
      ....
     i++;
     ...
}

At present, vif->idx is assigned the value of wl->vif_num
at the beginning of this block and device is initialized
based on this index value.
In the next iteration, wl->vif_num is still 0 as it is only updated
later but gets assigned to vif->idx in the beginning. This causes problems
later when we try to reference a particular interface and also while
configuring the firmware.

This patch moves the assignment to vif->idx from the beginning
of the block to after wl->vif_num is updated with latest value of i.

Fixes: commit 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
Signed-off-by: Aditya Shankar <aditya.shankar@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/staging/wilc1000/linux_wlan.c