[PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E()

2019-09-26 Thread Denis Efremov
It's incorrect to compare HighestRate with 0x0b twice in the following
manner "if (HighestRate > 0x0b) ... else if (HighestRate > 0x0b) ...". The
"else if" branch is constantly false. The second comparision should be
with 0x03 according to the max_rate_idx in ODM_RAInfo_Init().

Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
Cc: Michael Straube 
Cc: sta...@vger.kernel.org
Signed-off-by: Denis Efremov 
---
 drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c 
b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
index 9ddd51685063..5792f491b59a 100644
--- a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
+++ b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
@@ -409,7 +409,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct 
*dm_odm, struct odm_ra_inf
pRaInfo->PTModeSS = 3;
else if (pRaInfo->HighestRate > 0x0b)
pRaInfo->PTModeSS = 2;
-   else if (pRaInfo->HighestRate > 0x0b)
+   else if (pRaInfo->HighestRate > 0x03)
pRaInfo->PTModeSS = 1;
else
pRaInfo->PTModeSS = 0;
-- 
2.21.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


CONTACT,JP Morgan Chase Bank NY USA for your funds transfer US$16.5million Dollars deposited this morning,

2019-09-26 Thread Dr.JOHN DAVIDSON Dir IMF Benin.
ATTN,DEAR
CONTACT,JP Morgan Chase Bank NY USA for your funds transfer
US$16.5million Dollars deposited this morning,
Director, MS.Linda B. Bammann
The Bank is waiting to hear from you before transfer release to your
bank. This is to avoid any hitch problems. CONTACT this bank once to
receive your transfer today.
Director, MS.Linda B. Bammann
Emails/ jpmorganchasebank.n...@yahoo.com
Telephone. (603) 636-4063

Note,you can only text JP Morgan Chase Bank Ny USA Director, MS.Linda B. Bammann
On her telephone No#. She refuse to receive calls due to numerous
conversations from outside of the Country, So you had done well text
her on the given phone number or email. Finally For your
informations,I have paid the related transaction service fees for
you,such as Deposit and confirmations charges, so small money you been
required to pay is your funds transfer fees, sum of $90.00.only to
enable the bank complete transfer to your bank account immediately.
God bless you,
Dr.JOHN DAVIDSON
Dir IMF Benin.

Chase Bank is considered as one of the biggest and leading service provider
in the United States. The bank is a top listed national bank located in
Manhattan New York City. It is also one of the most trusted commercial and
consumer banking services on the planet.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8192e: clean up indentation issue

2019-09-26 Thread Colin King
From: Colin Ian King 

The RT_TRACE is indented incorrectly, add in the missing tabs.

Signed-off-by: Colin Ian King 
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index f932cb15e4e5..b08712a9c029 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -715,8 +715,8 @@ void rtl92e_set_wireless_mode(struct net_device *dev, u8 
wireless_mode)
if ((wireless_mode == WIRELESS_MODE_N_24G) ||
(wireless_mode == WIRELESS_MODE_N_5G)) {
priv->rtllib->pHTInfo->bEnableHT = 1;
-   RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 1\n",
-__func__, wireless_mode);
+   RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 1\n",
+__func__, wireless_mode);
} else {
priv->rtllib->pHTInfo->bEnableHT = 0;
RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 0\n",
-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8188eu: fix possible null dereference

2019-09-26 Thread Connor Kuehl

On 9/25/19 5:05 PM, Larry Finger wrote:

This change is a good one, but why not get the same fix at line 779?


Ah yes! Thanks for pointing that out. I missed that. I will send a V2 
shortly.


Thank you,

Connor



Larry



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: rtl8188eu: fix possible null dereference

2019-09-26 Thread Connor Kuehl
Inside a nested 'else' block at the beginning of this function is a
call that assigns 'psta' to the return value of 'rtw_get_stainfo()'.
If 'rtw_get_stainfo()' returns NULL and the flow of control reaches
the 'else if' where 'psta' is dereferenced, then we will dereference
a NULL pointer.

Fix this by checking if 'psta' is not NULL before reading its
'psta->qos_option' data member.

Addresses-Coverity: ("Dereference null return value")

Signed-off-by: Connor Kuehl 
---
v1 -> v2:
  - Add the same null check to line 779

 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 952f2ab51347..c37591657bac 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -776,7 +776,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, 
struct pkt_attrib *pattr
memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
 
-   if (psta->qos_option)
+   if (psta && psta->qos_option)
qos_option = true;
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@@ -784,7 +784,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, 
struct pkt_attrib *pattr
memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);
 
-   if (psta->qos_option)
+   if (psta && psta->qos_option)
qos_option = true;
} else {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, 
("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv)));
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: wilc1000: remove unnecessary netdev validation check in del_key()

2019-09-26 Thread Ajay.Kathat
From: Ajay Singh 

Removed unnecessary check to compare vif interface with zeroth index
element in vif array. Already the caller takes care of passing the
appropriate netdev handler during the del key operation.

Signed-off-by: Ajay Singh 
---
 .../staging/wilc1000/wilc_wfi_cfgoperations.c | 33 +--
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 22f21831649b..a1ca700e045a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -620,29 +620,26 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
   bool pairwise,
   const u8 *mac_addr)
 {
-   struct wilc *wl = wiphy_priv(wiphy);
struct wilc_vif *vif = netdev_priv(netdev);
struct wilc_priv *priv = &vif->priv;
 
-   if (netdev == wl->vif[0]->ndev) {
-   if (priv->wilc_gtk[key_index]) {
-   kfree(priv->wilc_gtk[key_index]->key);
-   priv->wilc_gtk[key_index]->key = NULL;
-   kfree(priv->wilc_gtk[key_index]->seq);
-   priv->wilc_gtk[key_index]->seq = NULL;
+   if (priv->wilc_gtk[key_index]) {
+   kfree(priv->wilc_gtk[key_index]->key);
+   priv->wilc_gtk[key_index]->key = NULL;
+   kfree(priv->wilc_gtk[key_index]->seq);
+   priv->wilc_gtk[key_index]->seq = NULL;
 
-   kfree(priv->wilc_gtk[key_index]);
-   priv->wilc_gtk[key_index] = NULL;
-   }
+   kfree(priv->wilc_gtk[key_index]);
+   priv->wilc_gtk[key_index] = NULL;
+   }
 
-   if (priv->wilc_ptk[key_index]) {
-   kfree(priv->wilc_ptk[key_index]->key);
-   priv->wilc_ptk[key_index]->key = NULL;
-   kfree(priv->wilc_ptk[key_index]->seq);
-   priv->wilc_ptk[key_index]->seq = NULL;
-   kfree(priv->wilc_ptk[key_index]);
-   priv->wilc_ptk[key_index] = NULL;
-   }
+   if (priv->wilc_ptk[key_index]) {
+   kfree(priv->wilc_ptk[key_index]->key);
+   priv->wilc_ptk[key_index]->key = NULL;
+   kfree(priv->wilc_ptk[key_index]->seq);
+   priv->wilc_ptk[key_index]->seq = NULL;
+   kfree(priv->wilc_ptk[key_index]);
+   priv->wilc_ptk[key_index] = NULL;
}
 
if (key_index <= 3 && priv->wep_key_len[key_index]) {
-- 
2.22.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: wilc1000: move wlan_deinit_locks() in wilc_netdev_cleanup()

2019-09-26 Thread Ajay.Kathat
From: Ajay Singh 

Move deinitialization of lock during the module remove and the
initialization of lock wilc_cfg80211_init(). This to ensure locks are
available during module load and gets free during unload.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_netdev.c| 14 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 --
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 +
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_netdev.c 
b/drivers/staging/wilc1000/wilc_netdev.c
index 508acb8bb089..d931fb2b2745 100644
--- a/drivers/staging/wilc1000/wilc_netdev.c
+++ b/drivers/staging/wilc1000/wilc_netdev.c
@@ -424,18 +424,6 @@ static int wilc_init_fw_config(struct net_device *dev, 
struct wilc_vif *vif)
return -1;
 }
 
-static void wlan_deinit_locks(struct net_device *dev)
-{
-   struct wilc_vif *vif = netdev_priv(dev);
-   struct wilc *wilc = vif->wilc;
-
-   mutex_destroy(&wilc->hif_cs);
-   mutex_destroy(&wilc->rxq_cs);
-   mutex_destroy(&wilc->cfg_cmd_lock);
-   mutex_destroy(&wilc->txq_add_to_head_cs);
-   mutex_destroy(&wilc->vif_mutex);
-}
-
 static void wlan_deinitialize_threads(struct net_device *dev)
 {
struct wilc_vif *vif = netdev_priv(dev);
@@ -477,7 +465,6 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
 
wilc_wlan_stop(wl, vif);
wilc_wlan_cleanup(dev);
-   wlan_deinit_locks(dev);
 
wl->initialized = false;
 
@@ -875,6 +862,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
flush_workqueue(wilc->hif_workqueue);
destroy_workqueue(wilc->hif_workqueue);
wilc_wlan_cfg_deinit(wilc);
+   wlan_deinit_locks(wilc);
kfree(wilc->bus_data);
wiphy_unregister(wilc->wiphy);
wiphy_free(wilc->wiphy);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a1ca700e045a..549b1d078198 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1802,6 +1802,15 @@ static void wlan_init_locks(struct wilc *wl)
init_completion(&wl->txq_thread_started);
 }
 
+void wlan_deinit_locks(struct wilc *wilc)
+{
+   mutex_destroy(&wilc->hif_cs);
+   mutex_destroy(&wilc->rxq_cs);
+   mutex_destroy(&wilc->cfg_cmd_lock);
+   mutex_destroy(&wilc->txq_add_to_head_cs);
+   mutex_destroy(&wilc->vif_mutex);
+}
+
 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
   const struct wilc_hif_func *ops)
 {
@@ -1813,6 +1822,8 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device 
*dev, int io_type,
if (!wl)
return -EINVAL;
 
+   wlan_init_locks(wl);
+
ret = wilc_wlan_cfg_init(wl);
if (ret)
goto free_wl;
@@ -1836,8 +1847,6 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device 
*dev, int io_type,
goto free_hq;
}
 
-   wlan_init_locks(wl);
-
return 0;
 
 free_hq:
@@ -1847,6 +1856,7 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device 
*dev, int io_type,
wilc_wlan_cfg_deinit(wl);
 
 free_wl:
+   wlan_deinit_locks(wl);
wiphy_unregister(wl->wiphy);
wiphy_free(wl->wiphy);
return ret;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 234faaabdb82..d802f884e525 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -24,4 +24,5 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc 
*wl,
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
  u16 frame_type, bool reg);
 struct wilc_vif *wilc_get_interface(struct wilc *wl);
+void wlan_deinit_locks(struct wilc *wilc);
 #endif
-- 
2.22.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: wilc1000: use RCU list to maintain vif interfaces list

2019-09-26 Thread Ajay.Kathat
From: Ajay Singh 

Make use of RCU list to maintain virtual interfaces instead of an array.
The update operation on 'vif' list is less compare to the read
operations. Mostly the 'vif' list elements are accessed for the read
operation, so RCU list is more suited for this requirement.
The shifting of interface index id's during the delete interface is not
required. As the firmware only supports 2 interfaces so make use of
available free slot index id during add interface.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_hif.c   |   8 +-
 drivers/staging/wilc1000/wilc_netdev.c| 117 ++-
 .../staging/wilc1000/wilc_wfi_cfgoperations.c | 141 --
 .../staging/wilc1000/wilc_wfi_cfgoperations.h |   1 +
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   4 +-
 5 files changed, 148 insertions(+), 123 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_hif.c 
b/drivers/staging/wilc1000/wilc_hif.c
index f2b7d5a1be17..0ac2b6ac50b0 100644
--- a/drivers/staging/wilc1000/wilc_hif.c
+++ b/drivers/staging/wilc1000/wilc_hif.c
@@ -183,11 +183,17 @@ int wilc_get_vif_idx(struct wilc_vif *vif)
 static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
 {
int index = idx - 1;
+   struct wilc_vif *vif;
 
if (index < 0 || index >= WILC_NUM_CONCURRENT_IFC)
return NULL;
 
-   return wilc->vif[index];
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (vif->idx == index)
+   return vif;
+   }
+
+   return NULL;
 }
 
 static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
diff --git a/drivers/staging/wilc1000/wilc_netdev.c 
b/drivers/staging/wilc1000/wilc_netdev.c
index d931fb2b2745..93c0d6e78813 100644
--- a/drivers/staging/wilc1000/wilc_netdev.c
+++ b/drivers/staging/wilc1000/wilc_netdev.c
@@ -97,29 +97,25 @@ void wilc_mac_indicate(struct wilc *wilc)
 static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
 {
u8 *bssid, *bssid1;
-   int i = 0;
struct net_device *ndev = NULL;
+   struct wilc_vif *vif;
 
bssid = mac_header + 10;
bssid1 = mac_header + 4;
 
-   mutex_lock(&wilc->vif_mutex);
-   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)) {
-   ndev = wilc->vif[i]->ndev;
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (vif->mode == WILC_STATION_MODE)
+   if (ether_addr_equal_unaligned(bssid, vif->bssid)) {
+   ndev = vif->ndev;
goto out;
}
-   if (wilc->vif[i]->mode == WILC_AP_MODE)
-   if (ether_addr_equal_unaligned(bssid1,
-  wilc->vif[i]->bssid)) {
-   ndev = wilc->vif[i]->ndev;
+   if (vif->mode == WILC_AP_MODE)
+   if (ether_addr_equal_unaligned(bssid1, vif->bssid)) {
+   ndev = vif->ndev;
goto out;
}
}
 out:
-   mutex_unlock(&wilc->vif_mutex);
return ndev;
 }
 
@@ -137,13 +133,16 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, 
u8 *bssid, u8 mode)
 
 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
 {
-   u8 i = 0;
+   int srcu_idx;
u8 ret_val = 0;
+   struct wilc_vif *vif;
 
-   for (i = 0; i < wilc->vif_num; i++)
-   if (!is_zero_ether_addr(wilc->vif[i]->bssid))
+   srcu_idx = srcu_read_lock(&wilc->srcu);
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (!is_zero_ether_addr(vif->bssid))
ret_val++;
-
+   }
+   srcu_read_unlock(&wilc->srcu, srcu_idx);
return ret_val;
 }
 
@@ -167,16 +166,16 @@ static int wilc_txq_task(void *vp)
do {
ret = wilc_wlan_handle_txq(wl, &txq_count);
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
-   int i;
+   int srcu_idx;
struct wilc_vif *ifc;
 
-   mutex_lock(&wl->vif_mutex);
-   for (i = 0; i < wl->vif_num; i++) {
-   ifc = wl->vif[i];
+   srcu_idx = srcu_read_lock(&wl->srcu);
+   list_for_each_entry_rcu(ifc, &wl->vif_list,
+   list) {
if (ifc->mac_opened && ifc->ndev)
netif_wake_queue(ifc->ndev);
 

[no subject]

2019-09-26 Thread Jeeeun Evans
linux-arm-ker...@lists.infradead.org, linux-ker...@vger.kernel.org 
Bcc: jeeeun.ev...@codethink.co.uk
Subject: [PATCH] staging: media: imx: Use devm_platform_ioremap_resource().
Reply-To: 

This patch fixes a warning by coccicheck:
drivers/staging/media/imx/imx7-mipi-csis.c:973:1-12: WARNING: Use 
devm_platform_ioremap_resource for state -> regs

Use devm_platform_ioremap_resource helper which wraps platform_get_resource()
and devm_ioremap_resource() together.

Signed-off-by: Jeeeun Evans 
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c
index 73d8354e618c..bf21db38441f 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -947,7 +947,6 @@ static void mipi_csis_debugfs_exit(struct csi_state *state)
 static int mipi_csis_probe(struct platform_device *pdev)
 {
struct device *dev = &pdev->dev;
-   struct resource *mem_res;
struct csi_state *state;
int ret;
 
@@ -969,8 +968,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
mipi_csis_phy_init(state);
mipi_csis_phy_reset(state);
 
-   mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   state->regs = devm_ioremap_resource(dev, mem_res);
+   state->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(state->regs))
return PTR_ERR(state->regs);
 
-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: media: imx: Use devm_platform_ioremap_resource().

2019-09-26 Thread Jeeeun Evans
This patch fixes a warning by coccicheck:
drivers/staging/media/imx/imx7-mipi-csis.c:973:1-12: WARNING: Use 
devm_platform_ioremap_resource for state -> regs

Use devm_platform_ioremap_resource helper which wraps platform_get_resource()
and devm_ioremap_resource() together.

Signed-off-by: Jeeeun Evans 
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c
index 73d8354e618c..bf21db38441f 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -947,7 +947,6 @@ static void mipi_csis_debugfs_exit(struct csi_state *state)
 static int mipi_csis_probe(struct platform_device *pdev)
 {
struct device *dev = &pdev->dev;
-   struct resource *mem_res;
struct csi_state *state;
int ret;
 
@@ -969,8 +968,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
mipi_csis_phy_init(state);
mipi_csis_phy_reset(state);
 
-   mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   state->regs = devm_ioremap_resource(dev, mem_res);
+   state->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(state->regs))
return PTR_ERR(state->regs);
 
-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rtl8188eu: fix possible null dereference

2019-09-26 Thread Larry Finger

On 9/26/19 10:03 AM, Connor Kuehl wrote:

Inside a nested 'else' block at the beginning of this function is a
call that assigns 'psta' to the return value of 'rtw_get_stainfo()'.
If 'rtw_get_stainfo()' returns NULL and the flow of control reaches
the 'else if' where 'psta' is dereferenced, then we will dereference
a NULL pointer.

Fix this by checking if 'psta' is not NULL before reading its
'psta->qos_option' data member.

Addresses-Coverity: ("Dereference null return value")

Signed-off-by: Connor Kuehl 
---
v1 -> v2:
   - Add the same null check to line 779

  drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 952f2ab51347..c37591657bac 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -776,7 +776,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, 
struct pkt_attrib *pattr
memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
  
-			if (psta->qos_option)

+   if (psta && psta->qos_option)
qos_option = true;
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@@ -784,7 +784,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, 
struct pkt_attrib *pattr
memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);
  
-			if (psta->qos_option)

+   if (psta && psta->qos_option)
qos_option = true;
} else {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x 
is not allowed to xmit frame\n", get_fwstate(pmlmepriv)));



Acked-by: Larry Finger 

Thanks,

Larry

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E()

2019-09-26 Thread Larry Finger

On 9/26/19 2:31 AM, Denis Efremov wrote:

It's incorrect to compare HighestRate with 0x0b twice in the following
manner "if (HighestRate > 0x0b) ... else if (HighestRate > 0x0b) ...". The
"else if" branch is constantly false. The second comparision should be
with 0x03 according to the max_rate_idx in ODM_RAInfo_Init().

Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
Cc: Michael Straube 
Cc: sta...@vger.kernel.org
Signed-off-by: Denis Efremov 
---
  drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c 
b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
index 9ddd51685063..5792f491b59a 100644
--- a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
+++ b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
@@ -409,7 +409,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct 
*dm_odm, struct odm_ra_inf
pRaInfo->PTModeSS = 3;
else if (pRaInfo->HighestRate > 0x0b)
pRaInfo->PTModeSS = 2;
-   else if (pRaInfo->HighestRate > 0x0b)
+   else if (pRaInfo->HighestRate > 0x03)
pRaInfo->PTModeSS = 1;
else
pRaInfo->PTModeSS = 0;



I agree that the original code is wrong; however, I prefer that changes that 
alter the execution should be tested. I see no evidence that such testing has 
been done. It probably does not matter because a highest rate between 3 and 0xb 
means 802.11g is in use, and that may no longer be a real-world situation.


With any future patches, you need to indicate if testing has been done.

Acked-by: Larry Finger 

Larry

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: media: imx: Use devm_platform_ioremap_resource().

2019-09-26 Thread Rui Miguel Silva
Hi Jeeeun,
On Thu 26 Sep 2019 at 16:55, Jeeeun Evans wrote:
> This patch fixes a warning by coccicheck:
> drivers/staging/media/imx/imx7-mipi-csis.c:973:1-12: WARNING: Use 
> devm_platform_ioremap_resource for state -> regs
>
> Use devm_platform_ioremap_resource helper which wraps platform_get_resource()
> and devm_ioremap_resource() together.
>
> Signed-off-by: Jeeeun Evans 
>

Thanks for the patch.
LGTM.

Reviewed-by: Rui Miguel Silva 

---
Cheers,
Rui


>  drivers/staging/media/imx/imx7-mipi-csis.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
> b/drivers/staging/media/imx/imx7-mipi-csis.c
> index 73d8354e618c..bf21db38441f 100644
> --- a/drivers/staging/media/imx/imx7-mipi-csis.c
> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> @@ -947,7 +947,6 @@ static void mipi_csis_debugfs_exit(struct csi_state 
> *state)
>  static int mipi_csis_probe(struct platform_device *pdev)
>  {
>   struct device *dev = &pdev->dev;
> - struct resource *mem_res;
>   struct csi_state *state;
>   int ret;
>
> @@ -969,8 +968,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
>   mipi_csis_phy_init(state);
>   mipi_csis_phy_reset(state);
>
> - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - state->regs = devm_ioremap_resource(dev, mem_res);
> + state->regs = devm_platform_ioremap_resource(pdev, 0);
>   if (IS_ERR(state->regs))
>   return PTR_ERR(state->regs);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rtl8188eu: remove dead code/vestigial do..while loop

2019-09-26 Thread Larry Finger

On 9/24/19 9:28 AM, Connor Kuehl wrote:

The local variable 'bcmd_down' is always set to true almost immediately
before the do-while's condition is checked. As a result, !bcmd_down
evaluates to false which short circuits the logical AND operator meaning
that the second operand is never reached and is therefore dead code.

Furthermore, the do..while loop may be removed since it will always only
execute once because 'bcmd_down' is always set to true, so the
!bcmd_down evaluates to false and the loop exits immediately after the
first pass.

Fix this by removing the loop and its condition variables 'bcmd_down'
and 'retry_cnts'

While we're in there, also fix some checkpatch.pl suggestions regarding
spaces around arithmetic operators like '+'

Addresses-Coverity: ("Logically dead code")

Signed-off-by: Connor Kuehl 
---
v1 -> v2:
  - remove the loop and its condition variable bcmd_down
  - address some non-invasive checkpatch.pl suggestions as a result of
deleting the loop

  drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c | 55 +---
  1 file changed, 24 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
index 47352f210c0b..7646167a0b36 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
@@ -47,8 +47,6 @@ static u8 _is_fw_read_cmd_down(struct adapter *adapt, u8 
msgbox_num)
  **/
  static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 
*pCmdBuffer)
  {
-   u8 bcmd_down = false;
-   s32 retry_cnts = 100;
u8 h2c_box_num;
u32 msgbox_addr;
u32 msgbox_ex_addr;
@@ -71,39 +69,34 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 
ElementID, u32 CmdLen, u8 *p
goto exit;
  
  	/* pay attention to if  race condition happened in  H2C cmd setting. */

-   do {
-   h2c_box_num = adapt->HalData->LastHMEBoxNum;
-
-   if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) {
-   DBG_88E(" fw read cmd failed...\n");
-   goto exit;
-   }
-
-   *(u8 *)(&h2c_cmd) = ElementID;
-
-   if (CmdLen <= 3) {
-   memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, CmdLen);
-   } else {
-   memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, 3);
-   ext_cmd_len = CmdLen-3;
-   memcpy((u8 *)(&h2c_cmd_ex), pCmdBuffer+3, ext_cmd_len);
+   h2c_box_num = adapt->HalData->LastHMEBoxNum;
  
-			/* Write Ext command */

-   msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * 
RTL88E_EX_MESSAGE_BOX_SIZE);
-   for (cmd_idx = 0; cmd_idx < ext_cmd_len; cmd_idx++)
-   usb_write8(adapt, msgbox_ex_addr+cmd_idx, *((u8 
*)(&h2c_cmd_ex)+cmd_idx));
-   }
-   /*  Write command */
-   msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * 
RTL88E_MESSAGE_BOX_SIZE);
-   for (cmd_idx = 0; cmd_idx < RTL88E_MESSAGE_BOX_SIZE; cmd_idx++)
-   usb_write8(adapt, msgbox_addr+cmd_idx, *((u8 
*)(&h2c_cmd)+cmd_idx));
+   if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) {
+   DBG_88E(" fw read cmd failed...\n");
+   goto exit;
+   }
  
-		bcmd_down = true;

+   *(u8 *)(&h2c_cmd) = ElementID;
  
-		adapt->HalData->LastHMEBoxNum =

-   (h2c_box_num+1) % RTL88E_MAX_H2C_BOX_NUMS;
+   if (CmdLen <= 3) {
+   memcpy((u8 *)(&h2c_cmd) + 1, pCmdBuffer, CmdLen);
+   } else {
+   memcpy((u8 *)(&h2c_cmd) + 1, pCmdBuffer, 3);
+   ext_cmd_len = CmdLen - 3;
+   memcpy((u8 *)(&h2c_cmd_ex), pCmdBuffer + 3, ext_cmd_len);
+
+   /* Write Ext command */
+   msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * 
RTL88E_EX_MESSAGE_BOX_SIZE);
+   for (cmd_idx = 0; cmd_idx < ext_cmd_len; cmd_idx++)
+   usb_write8(adapt, msgbox_ex_addr + cmd_idx, *((u8 
*)(&h2c_cmd_ex) + cmd_idx));
+   }
+   /*  Write command */
+   msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * RTL88E_MESSAGE_BOX_SIZE);
+   for (cmd_idx = 0; cmd_idx < RTL88E_MESSAGE_BOX_SIZE; cmd_idx++)
+   usb_write8(adapt, msgbox_addr + cmd_idx, *((u8 *)(&h2c_cmd) + 
cmd_idx));
  
-	} while ((!bcmd_down) && (retry_cnts--));

+   adapt->HalData->LastHMEBoxNum =
+   (h2c_box_num + 1) % RTL88E_MAX_H2C_BOX_NUMS;
  
  	ret = _SUCCESS;


Acked-by: Larry Finger 

Thanks,

Larry

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: remove unused function write_cam_from_cache

2019-09-26 Thread Michael Straube
Function write_cam_from_cache in rtw_wlan_util.c is never used,
so remove it.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c   | 13 -
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h |  1 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 5ab98f3e722e..3933e8637e57 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -606,19 +606,6 @@ inline void clear_cam_entry(struct adapter *adapter, u8 id)
clear_cam_cache(adapter, id);
 }
 
-inline void write_cam_from_cache(struct adapter *adapter, u8 id)
-{
-   struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
-   struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl;
-   struct cam_entry_cache cache;
-
-   spin_lock_bh(&cam_ctl->lock);
-   memcpy(&cache, &dvobj->cam_cache[id], sizeof(struct cam_entry_cache));
-   spin_unlock_bh(&cam_ctl->lock);
-
-   _write_cam(adapter, id, cache.ctrl, cache.mac, cache.key);
-}
-
 void write_cam_cache(struct adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 
*key)
 {
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index fd3cf955c9f8..73e8ec09b6e1 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -576,7 +576,6 @@ void read_cam(struct adapter *padapter , u8 entry, u8 
*get_key);
 /* modify HW only */
 void _write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 
*key);
 void _clear_cam_entry(struct adapter *padapter, u8 entry);
-void write_cam_from_cache(struct adapter *adapter, u8 id);
 
 /* modify both HW and cache */
 void write_cam(struct adapter *padapter, u8 id, u16 ctrl, u8 *mac, u8 *key);
-- 
2.23.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel