diff mbox series

[08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count

Message ID 1549134974-5545-9-git-send-email-ajay.kathat@microchip.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show
Series staging: wilc1000: cleanup patches & handle review comments | expand

Commit Message

Ajay Singh Feb. 2, 2019, 7:17 p.m. UTC
From: Ajay Singh <ajay.kathat@microchip.com>

The value of 'vif_num'(interface count) starts with 0, so modified the
loop conditions to execute for all interface.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Dan Carpenter Feb. 4, 2019, 8:13 a.m. UTC | #1
On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> From: Ajay Singh <ajay.kathat@microchip.com>
> 
> The value of 'vif_num'(interface count) starts with 0, so modified the
> loop conditions to execute for all interface.
> 
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>

The right thing to do is to change ->vif_num = i + 1 in
wilc_netdev_init().  That's how it was originally.  Please, add a
Fixes tag.

Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")

regards,
dan carpenter
Ajay Singh Feb. 4, 2019, 9:42 a.m. UTC | #2
On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
>> From: Ajay Singh <ajay.kathat@microchip.com>
>>
>> The value of 'vif_num'(interface count) starts with 0, so modified the
>> loop conditions to execute for all interface.
>>
>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> 
> The right thing to do is to change ->vif_num = i + 1 in
> wilc_netdev_init().  That's how it was originally.  Please, add a
> Fixes tag.
> 
> Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> 

Thanks. Sure, I will add Fixes tag and resubmit the changes.

Can other patches from the series be applied excluding this or should I
resubmit the complete series?
Please suggest.

Regards,
Ajay
Dan Carpenter Feb. 4, 2019, 9:47 a.m. UTC | #3
On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
> 
> 
> On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> > On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> >> From: Ajay Singh <ajay.kathat@microchip.com>
> >>
> >> The value of 'vif_num'(interface count) starts with 0, so modified the
> >> loop conditions to execute for all interface.
> >>
> >> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > 
> > The right thing to do is to change ->vif_num = i + 1 in
> > wilc_netdev_init().  That's how it was originally.  Please, add a
> > Fixes tag.
> > 
> > Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> > 
> 
> Thanks. Sure, I will add Fixes tag and resubmit the changes.
> 
> Can other patches from the series be applied excluding this or should I
> resubmit the complete series?
> Please suggest.

I don't have an opinion on that.  I guess if you just resend them all,
that's the easiest for Greg.

regards,
dan carpenter
Greg Kroah-Hartman Feb. 4, 2019, 11:39 a.m. UTC | #4
On Mon, Feb 04, 2019 at 12:47:23PM +0300, Dan Carpenter wrote:
> On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
> > 
> > 
> > On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> > > On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> > >> From: Ajay Singh <ajay.kathat@microchip.com>
> > >>
> > >> The value of 'vif_num'(interface count) starts with 0, so modified the
> > >> loop conditions to execute for all interface.
> > >>
> > >> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > > 
> > > The right thing to do is to change ->vif_num = i + 1 in
> > > wilc_netdev_init().  That's how it was originally.  Please, add a
> > > Fixes tag.
> > > 
> > > Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> > > 
> > 
> > Thanks. Sure, I will add Fixes tag and resubmit the changes.
> > 
> > Can other patches from the series be applied excluding this or should I
> > resubmit the complete series?
> > Please suggest.
> 
> I don't have an opinion on that.  I guess if you just resend them all,
> that's the easiest for Greg.

I took the first 7 patches here, so just a respin of the remaining ones
would be fine.

thanks,

greg k-h
Ajay Singh Feb. 4, 2019, 12:25 p.m. UTC | #5
Hi Greg,

On 2/4/2019 5:09 PM, Greg KH wrote:
> On Mon, Feb 04, 2019 at 12:47:23PM +0300, Dan Carpenter wrote:
>> On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
>>>
>>>
>>> On 2/4/2019 1:43 PM, Dan Carpenter wrote:
>>>> On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
>>>>> From: Ajay Singh <ajay.kathat@microchip.com>
>>>>>
>>>>> The value of 'vif_num'(interface count) starts with 0, so modified the
>>>>> loop conditions to execute for all interface.
>>>>>
>>>>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
>>>>
>>>> The right thing to do is to change ->vif_num = i + 1 in
>>>> wilc_netdev_init().  That's how it was originally.  Please, add a
>>>> Fixes tag.
>>>>
>>>> Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
>>>>
>>>
>>> Thanks. Sure, I will add Fixes tag and resubmit the changes.
>>>
>>> Can other patches from the series be applied excluding this or should I
>>> resubmit the complete series?
>>> Please suggest.
>>
>> I don't have an opinion on that.  I guess if you just resend them all,
>> that's the easiest for Greg.
> 
> I took the first 7 patches here, so just a respin of the remaining ones
> would be fine.
> 

Thanks alot.
This patch will take some time for modification. As remaining patches
are not dependent on this. I will resend them.

Regards,
Ajay
diff mbox series

Patch

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 3576834..fde236a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1659,7 +1659,7 @@  int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 		return -ENOMEM;
 
 	*hif_drv_handler = hif_drv;
-	for (i = 0; i < wilc->vif_num; i++)
+	for (i = 0; i <= wilc->vif_num; i++)
 		if (dev == wilc->vif[i]->ndev) {
 			wilc->vif[i]->hif_drv = hif_drv;
 			hif_drv->driver_handler_id = i + 1;
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 81472d2..466a1fa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -164,7 +164,7 @@  static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
 	bssid = mac_header + 10;
 	bssid1 = mac_header + 4;
 
-	for (i = 0; i < wilc->vif_num; i++) {
+	for (i = 0; i <= wilc->vif_num; i++) {
 		if (wilc->vif[i]->mode == WILC_STATION_MODE)
 			if (ether_addr_equal_unaligned(bssid,
 						       wilc->vif[i]->bssid))
@@ -195,7 +195,7 @@  int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
 	u8 i = 0;
 	u8 ret_val = 0;
 
-	for (i = 0; i < wilc->vif_num; i++)
+	for (i = 0; i <= wilc->vif_num; i++)
 		if (!is_zero_ether_addr(wilc->vif[i]->bssid))
 			ret_val++;
 
@@ -739,7 +739,7 @@  static int wilc_mac_open(struct net_device *ndev)
 		return ret;
 	}
 
-	for (i = 0; i < wl->vif_num; i++) {
+	for (i = 0; i <= wl->vif_num; i++) {
 		if (ndev == wl->vif[i]->ndev) {
 			wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
 						 vif->iftype, vif->ifc_id);
@@ -941,7 +941,7 @@  void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 	int i = 0;
 	struct wilc_vif *vif;
 
-	for (i = 0; i < wilc->vif_num; i++) {
+	for (i = 0; i <= wilc->vif_num; i++) {
 		vif = netdev_priv(wilc->vif[i]->ndev);
 		if (vif->monitor_flag) {
 			wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size);