linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org,
	"Roland Vossen" <rvossen@broadcom.com>,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 05/31] staging: brcm80211: removed asserts from two fullmac files
Date: Wed, 6 Jul 2011 00:02:32 +0200	[thread overview]
Message-ID: <1309903378-29021-6-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1309903378-29021-1-git-send-email-arend@broadcom.com>

From: Roland Vossen <rvossen@broadcom.com>

ASSERTs are non desirable, replaced by error handling where applicable.

Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c  |   37 +++++++-------------
 .../brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c        |    2 -
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 3f3f0ee..76a2c8b 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -279,12 +279,16 @@ brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
 	bool bool_val;
 	u32 actionid;
 
-	ASSERT(name);
-	ASSERT(len >= 0);
+	if (name == NULL || len <= 0)
+		return -EINVAL;
 
-	/* Get must have return space; Set does not take qualifiers */
-	ASSERT(set || (arg && len));
-	ASSERT(!set || (!params && !plen));
+	/* Set does not take qualifiers */
+	if (set && (params || plen))
+		return -EINVAL;
+
+	/* Get must have return space;*/
+	if (!set && !(arg && len))
+		return -EINVAL;
 
 	sd_trace(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),
 		  name));
@@ -676,7 +680,6 @@ brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
 
 	sd_trace(("%s: Enter\n", __func__));
 
-	ASSERT(pkt);
 	BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
 	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
 
@@ -687,14 +690,6 @@ brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
 		pkt_len += 3;
 		pkt_len &= 0xFFFFFFFC;
 
-		/* Make sure the packet is aligned properly.
-		 * If it isn't, then this
-		 * is the fault of brcmf_sdioh_request_buffer() which
-		 * is supposed to give
-		 * us something we can work with.
-		 */
-		ASSERT(((ulong) (pkt->data) & DMA_ALIGN_MASK) == 0);
-
 		if ((write) && (!fifo)) {
 			err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
 						   ((u8 *) (pnext->data)),
@@ -789,11 +784,10 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
 
 		brcmu_pkt_buf_free_skb(mypkt);
 	} else if (((ulong) (pkt->data) & DMA_ALIGN_MASK) != 0) {
-		/* Case 2: We have a packet, but it is unaligned. */
-
-		/* In this case, we cannot have a chain. */
-		ASSERT(pkt->next == NULL);
-
+		/*
+		 * Case 2: We have a packet, but it is unaligned.
+		 * In this case, we cannot have a chain (pkt->next == NULL)
+		 */
 		sd_data(("%s: Creating aligned %s Packet, len=%d\n",
 			 __func__, write ? "TX" : "RX", pkt->len));
 		mypkt = brcmu_pkt_buf_get_skb(pkt->len);
@@ -886,13 +880,10 @@ static void brcmf_sdioh_irqhandler(struct sdio_func *func)
 	sd_trace(("brcmf: ***IRQHandler\n"));
 	sd = gInstance->sd;
 
-	ASSERT(sd != NULL);
 	sdio_release_host(gInstance->func[0]);
 
 	if (sd->use_client_ints) {
 		sd->intrcount++;
-		ASSERT(sd->intr_handler);
-		ASSERT(sd->intr_handler_arg);
 		(sd->intr_handler) (sd->intr_handler_arg);
 	} else {
 		sd_err(("brcmf: ***IRQHandler\n"));
@@ -912,6 +903,4 @@ static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func)
 	sd_trace(("brcmf: ***IRQHandlerF2\n"));
 
 	sd = gInstance->sd;
-
-	ASSERT(sd != NULL);
 }
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
index e229bcb..7d4b2e3 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
@@ -194,7 +194,6 @@ int brcmf_sdioh_osinit(struct sdioh_info *sd)
 void brcmf_sdioh_osfree(struct sdioh_info *sd)
 {
 	struct sdos_info *sdos;
-	ASSERT(sd && sd->sdos_info);
 
 	sdos = (struct sdos_info *)sd->sdos_info;
 	kfree(sdos);
@@ -209,7 +208,6 @@ int brcmf_sdioh_interrupt_set(struct sdioh_info *sd, bool enable)
 	sd_trace(("%s: %s\n", __func__, enable ? "Enabling" : "Disabling"));
 
 	sdos = (struct sdos_info *)sd->sdos_info;
-	ASSERT(sdos);
 
 	if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
 		sd_err(("%s: no handler registered, will not enable\n",
-- 
1.7.4.1



  parent reply	other threads:[~2011-07-05 22:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 22:02 [PATCH 00/31] staging: brcm80211: fullmac cleanup and checkpatch fixes Arend van Spriel
2011-07-05 22:02 ` [PATCH 01/31] staging: brcm80211: clean up checkpatch error Arend van Spriel
2011-07-05 22:02 ` [PATCH 02/31] staging: brcm80211: removed occurrences of 'dhd' Arend van Spriel
2011-07-05 22:02 ` [PATCH 03/31] staging: brcm80211: removed unused #ifdef sections in fullmac Arend van Spriel
2011-07-05 22:02 ` [PATCH 04/31] staging: brcm80211: rename macros in dhd_dbg.h Arend van Spriel
2011-07-05 22:02 ` Arend van Spriel [this message]
2011-07-05 22:02 ` [PATCH 06/31] staging: brcm80211: removed asserts from bcmsdh.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 07/31] staging: brcm80211: removed asserts from dhd_cdc.c and dhd_common.c Arend van Spriel
2011-07-06  9:24   ` Dan Carpenter
2011-07-06 14:27     ` Roland Vossen
2011-07-05 22:02 ` [PATCH 08/31] staging: brcm80211: removed asserts from dhd_linux.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 09/31] staging: brcm80211: removed asserts from dhd_sdio.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 10/31] staging: brcm80211: removed remains of assert mechanism in fullmac Arend van Spriel
2011-07-05 22:02 ` [PATCH 11/31] staging: brcm80211: replaced various typedefs in softmac Arend van Spriel
2011-07-05 22:02 ` [PATCH 12/31] staging: brcm80211: replaced typedef phy_info_t by struct brcms_phy Arend van Spriel
2011-07-05 22:02 ` [PATCH 13/31] staging: brcm80211: replaced typedef wlc_phy_t with struct brcms_phy_pub Arend van Spriel
2011-07-05 22:02 ` [PATCH 14/31] staging: brcm80211: replaced typedef tx_power_t by struct brcms_tx_power Arend van Spriel
2011-07-05 22:02 ` [PATCH 15/31] staging: brcm80211: renamed structures in softmac Arend van Spriel
2011-07-05 22:02 ` [PATCH 16/31] staging: brcm80211: remove checkpatch warnings 'suspect code indent' Arend van Spriel
2011-07-05 22:02 ` [PATCH 17/31] staging: brcm80211: made name lookup arrays more const Arend van Spriel
2011-07-05 22:02 ` [PATCH 18/31] staging: brcm80211: remove checkpatch warnings from phy_n.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 19/31] staging: brcm80211: replaced Broadcom specific acronym WLC Arend van Spriel
2011-07-05 22:02 ` [PATCH 20/31] staging: brcm80211: deleted two fullmac source files Arend van Spriel
2011-07-05 22:02 ` [PATCH 21/31] staging: brcm80211: merged dngl_stats.h into dhd.h Arend van Spriel
2011-07-05 22:02 ` [PATCH 22/31] staging: brcm80211: merged sbsdio.h into sdio_host.h Arend van Spriel
2011-07-05 22:02 ` [PATCH 23/31] staging: brcm80211: merged bcmsdbus.h " Arend van Spriel
2011-07-05 22:02 ` [PATCH 24/31] staging: brcm80211: moved fullmac definitions from .h to .c files Arend van Spriel
2011-07-05 22:02 ` [PATCH 25/31] staging: brcm80211: removed #ifdef SDIOH_API_ACCESS_RETRY_LIMIT Arend van Spriel
2011-07-05 22:02 ` [PATCH 26/31] staging: brcm80211: replace occurrences of __attribute__((packed)) Arend van Spriel
2011-07-05 22:02 ` [PATCH 27/31] staging: brcm80211: remove several externs from dhd_linux.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 28/31] staging: brcm80211: remove external definitions from phy_lcn.c Arend van Spriel
2011-07-05 22:02 ` [PATCH 29/31] staging: brcm80211: remove macro WLBANDINITFN from brcmsmac Arend van Spriel
2011-07-05 22:02 ` [PATCH 30/31] staging: brcm80211: simpler string handling in brcmf_c_pktfilter_offload_set() Arend van Spriel
2011-07-05 22:02 ` [PATCH 31/31] staging: brcm80211: added newlines to some debug macros in bcmsdh_sdmmc.c Arend van Spriel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309903378-29021-6-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rvossen@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).