aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEcco Park <eccopark@broadcom.com>2013-09-24 05:19:10 +0900
committerZiyan <jaraidaniel@gmail.com>2016-05-01 23:35:27 +0200
commitd3a4cc7eea274fd7fbec3ba86eff920a42c77803 (patch)
tree846d783999420733fafaef0a3d78884b8ab38de5 /drivers
parente29f2badc493558de27873c1a342ca565f61ba19 (diff)
downloadkernel_samsung_tuna-d3a4cc7eea274fd7fbec3ba86eff920a42c77803.zip
kernel_samsung_tuna-d3a4cc7eea274fd7fbec3ba86eff920a42c77803.tar.gz
kernel_samsung_tuna-d3a4cc7eea274fd7fbec3ba86eff920a42c77803.tar.bz2
net: wireless: bcmdhd: Fixed Coverity issue.
Signed-off-by: Ecco Park <eccopark@broadcom.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_common.c12
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_pno.c57
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfg80211.h12
-rw-r--r--drivers/net/wireless/bcmdhd/wldev_common.c12
4 files changed, 50 insertions, 43 deletions
diff --git a/drivers/net/wireless/bcmdhd/dhd_common.c b/drivers/net/wireless/bcmdhd/dhd_common.c
index 82398a6..9fad303 100644
--- a/drivers/net/wireless/bcmdhd/dhd_common.c
+++ b/drivers/net/wireless/bcmdhd/dhd_common.c
@@ -54,12 +54,12 @@
#include <linux/jiffies.h>
#endif
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
+#define htod32(i) (i)
+#define htod16(i) (i)
+#define dtoh32(i) (i)
+#define dtoh16(i) (i)
+#define htodchanspec(i) (i)
+#define dtohchanspec(i) (i)
#ifdef PROP_TXSTATUS
#include <wlfc_proto.h>
diff --git a/drivers/net/wireless/bcmdhd/dhd_pno.c b/drivers/net/wireless/bcmdhd/dhd_pno.c
index 5f7657d..5e1cb24 100644
--- a/drivers/net/wireless/bcmdhd/dhd_pno.c
+++ b/drivers/net/wireless/bcmdhd/dhd_pno.c
@@ -53,12 +53,12 @@
#define htodchanspec(i) htod16(i)
#define dtohchanspec(i) dtoh16(i)
#else
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
+#define htod32(i) (i)
+#define htod16(i) (i)
+#define dtoh32(i) (i)
+#define dtoh16(i) (i)
+#define htodchanspec(i) (i)
+#define dtohchanspec(i) (i)
#endif /* IL_BIGENDINA */
#define NULL_CHECK(p, s, err) \
@@ -91,8 +91,9 @@ is_dfs(uint16 channel)
else
return FALSE;
}
-static int
-_dhd_pno_clean(dhd_pub_t *dhd)
+
+int
+dhd_pno_clean(dhd_pub_t *dhd)
{
int pfn = 0;
int err;
@@ -126,7 +127,9 @@ _dhd_pno_suspend(dhd_pub_t *dhd)
dhd_pno_status_info_t *_pno_state;
NULL_CHECK(dhd, "dhd is NULL", err);
NULL_CHECK(dhd->pno_state, "pno_state is NULL", err);
+
DHD_PNO(("%s enter\n", __FUNCTION__));
+ _pno_state = PNO_GET_PNOSTATE(dhd);
err = dhd_iovar(dhd, 0, "pfn_suspend", (char *)&suspend, sizeof(suspend), 1);
if (err < 0) {
DHD_ERROR(("%s : failed to suspend pfn(error :%d)\n", __FUNCTION__, err));
@@ -764,7 +767,7 @@ dhd_pno_stop_for_ssid(dhd_pub_t *dhd)
dhd_pno_get_for_batch(dhd, NULL, 0, PNO_STATUS_DISABLE);
/* save current pno_mode before calling dhd_pno_clean */
mode = _pno_state->pno_mode;
- _dhd_pno_clean(dhd);
+ dhd_pno_clean(dhd);
/* restore previous pno_mode */
_pno_state->pno_mode = mode;
if (_pno_state->pno_mode & DHD_PNO_BATCH_MODE) {
@@ -808,9 +811,9 @@ dhd_pno_stop_for_ssid(dhd_pub_t *dhd)
}
}
} else {
- err = _dhd_pno_clean(dhd);
+ err = dhd_pno_clean(dhd);
if (err < 0) {
- DHD_ERROR(("%s : failed to call _dhd_pno_clean (err: %d)\n",
+ DHD_ERROR(("%s : failed to call dhd_pno_clean (err: %d)\n",
__FUNCTION__, err));
goto exit;
}
@@ -1342,9 +1345,11 @@ convert_format:
exit:
if (plbestnet)
MFREE(dhd->osh, plbestnet, PNO_BESTNET_LEN);
- _params->params_batch.get_batch.buf = NULL;
- _params->params_batch.get_batch.bufsize = 0;
- _params->params_batch.get_batch.bytes_written = err;
+ if (_params) {
+ _params->params_batch.get_batch.buf = NULL;
+ _params->params_batch.get_batch.bufsize = 0;
+ _params->params_batch.get_batch.bytes_written = err;
+ }
mutex_unlock(&_pno_state->pno_mutex);
if (waitqueue_active(&_pno_state->get_batch_done.wait))
complete(&_pno_state->get_batch_done);
@@ -1441,7 +1446,7 @@ dhd_pno_stop_for_batch(dhd_pub_t *dhd)
_pno_state->pno_mode &= ~DHD_PNO_BATCH_MODE;
if (_pno_state->pno_mode & (DHD_PNO_LEGACY_MODE | DHD_PNO_HOTLIST_MODE)) {
mode = _pno_state->pno_mode;
- _dhd_pno_clean(dhd);
+ dhd_pno_clean(dhd);
_pno_state->pno_mode = mode;
/* restart Legacy PNO if the Legacy PNO is on */
if (_pno_state->pno_mode & DHD_PNO_LEGACY_MODE) {
@@ -1505,9 +1510,9 @@ dhd_pno_stop_for_batch(dhd_pub_t *dhd)
}
}
} else {
- err = _dhd_pno_clean(dhd);
+ err = dhd_pno_clean(dhd);
if (err < 0) {
- DHD_ERROR(("%s : failed to call _dhd_pno_clean (err: %d)\n",
+ DHD_ERROR(("%s : failed to call dhd_pno_clean (err: %d)\n",
__FUNCTION__, err));
goto exit;
}
@@ -1700,9 +1705,9 @@ dhd_pno_stop_for_hotlist(dhd_pub_t *dhd)
dhd_pno_get_for_batch(dhd, NULL, 0, PNO_STATUS_DISABLE);
/* save current pno_mode before calling dhd_pno_clean */
mode = _pno_state->pno_mode;
- err = _dhd_pno_clean(dhd);
+ err = dhd_pno_clean(dhd);
if (err < 0) {
- DHD_ERROR(("%s : failed to call _dhd_pno_clean (err: %d)\n",
+ DHD_ERROR(("%s : failed to call dhd_pno_clean (err: %d)\n",
__FUNCTION__, err));
goto exit;
}
@@ -1752,9 +1757,9 @@ dhd_pno_stop_for_hotlist(dhd_pub_t *dhd)
}
}
} else {
- err = _dhd_pno_clean(dhd);
+ err = dhd_pno_clean(dhd);
if (err < 0) {
- DHD_ERROR(("%s : failed to call _dhd_pno_clean (err: %d)\n",
+ DHD_ERROR(("%s : failed to call dhd_pno_clean (err: %d)\n",
__FUNCTION__, err));
goto exit;
}
@@ -1816,8 +1821,8 @@ int dhd_pno_init(dhd_pub_t *dhd)
if (dhd->pno_state)
goto exit;
dhd->pno_state = MALLOC(dhd->osh, sizeof(dhd_pno_status_info_t));
+ NULL_CHECK(dhd->pno_state, "failed to create dhd_pno_state", err);
memset(dhd->pno_state, 0, sizeof(dhd_pno_status_info_t));
- NULL_CHECK(dhd, "failed to create dhd_pno_state", err);
/* need to check whether current firmware support batching and hotlist scan */
_pno_state = PNO_GET_PNOSTATE(dhd);
_pno_state->wls_supported = TRUE;
@@ -1837,18 +1842,20 @@ exit:
int dhd_pno_deinit(dhd_pub_t *dhd)
{
int err = BCME_OK;
- dhd_pno_status_info_t *_pno_state = PNO_GET_PNOSTATE(dhd);
+ dhd_pno_status_info_t *_pno_state;
dhd_pno_params_t *_params;
NULL_CHECK(dhd, "dhd is NULL", err);
+
DHD_PNO(("%s enter\n", __FUNCTION__));
+ _pno_state = PNO_GET_PNOSTATE(dhd);
+ NULL_CHECK(_pno_state, "pno_state is NULL", err);
if (_pno_state->pno_mode & DHD_PNO_BATCH_MODE) {
_params = &_pno_state->pno_params_arr[INDEX_OF_BATCH_PARAMS];
/* clear resource if the BATCH MODE is on */
_dhd_pno_reinitialize_prof(dhd, _params, DHD_PNO_BATCH_MODE);
}
cancel_work_sync(&_pno_state->work);
- if (dhd->pno_state)
- MFREE(dhd->osh, dhd->pno_state, sizeof(dhd_pno_status_info_t));
+ MFREE(dhd->osh, _pno_state, sizeof(dhd_pno_status_info_t));
dhd->pno_state = NULL;
return err;
}
diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.h b/drivers/net/wireless/bcmdhd/wl_cfg80211.h
index f414623..f31919a 100644
--- a/drivers/net/wireless/bcmdhd/wl_cfg80211.h
+++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.h
@@ -44,12 +44,12 @@ struct wl_security;
struct wl_ibss;
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
+#define htod32(i) (i)
+#define htod16(i) (i)
+#define dtoh32(i) (i)
+#define dtoh16(i) (i)
+#define htodchanspec(i) (i)
+#define dtohchanspec(i) (i)
#define WL_DBG_NONE 0
#define WL_DBG_P2P_ACTION (1 << 5)
diff --git a/drivers/net/wireless/bcmdhd/wldev_common.c b/drivers/net/wireless/bcmdhd/wldev_common.c
index 73b7511..361235b 100644
--- a/drivers/net/wireless/bcmdhd/wldev_common.c
+++ b/drivers/net/wireless/bcmdhd/wldev_common.c
@@ -32,12 +32,12 @@
#include <wldev_common.h>
#include <bcmutils.h>
-#define htod32(i) i
-#define htod16(i) i
-#define dtoh32(i) i
-#define dtoh16(i) i
-#define htodchanspec(i) i
-#define dtohchanspec(i) i
+#define htod32(i) (i)
+#define htod16(i) (i)
+#define dtoh32(i) (i)
+#define dtoh16(i) (i)
+#define htodchanspec(i) (i)
+#define dtohchanspec(i) (i)
#define WLDEV_ERROR(args) \
do { \