aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-20 23:56:25 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-26 09:53:14 -0400
commit992875b481b3354067b8b3323864510fe0389103 (patch)
treeca0030d60f219d4349c04debc99aeb3ad5f312b7
parent99fb0183fe404486674f73a3aa5b37b5e9e817d9 (diff)
[PATCH] Avoid assignments inside conditions, they are hard to read
Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 3b1a1a4..3e84c7b 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -719,7 +719,8 @@ static int at76_download_external_fw(struct usb_device *udev, u8 *buf, int size)
at76_dbg(DBG_DEVSTART,
"ext fw, size left = %5d, bsize = %4d, i = %2d",
size, bsize, i);
- if ((ret = at76_load_ext_fw_block(udev, i, block, bsize)) < 0) {
+ ret = at76_load_ext_fw_block(udev, i, block, bsize);
+ if (ret < 0) {
err("loading %dth firmware block failed: %d", i, ret);
goto exit;
}
@@ -730,7 +731,8 @@ static int at76_download_external_fw(struct usb_device *udev, u8 *buf, int size)
/* for fw >= 0.100, the device needs
an extra empty block: */
- if ((ret = at76_load_ext_fw_block(udev, i, block, 0)) < 0) {
+ ret = at76_load_ext_fw_block(udev, i, block, 0);
+ if (ret < 0) {
err("loading %dth firmware block failed: %d", ret, i);
goto exit;
}
@@ -1623,7 +1625,8 @@ static int at76_send_mgmt_bulk(struct at76_priv *priv,
spin_lock_irqsave(&priv->mgmt_spinlock, flags);
- if ((urb_status = priv->write_urb->status) == -EINPROGRESS) {
+ urb_status = priv->write_urb->status;
+ if (urb_status == -EINPROGRESS) {
oldbuf = priv->next_mgmt_bulk; /* to kfree below */
priv->next_mgmt_bulk = txbuf;
txbuf = NULL;
@@ -1999,7 +2002,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
int status, ret;
struct mib_mdomain mdomain;
- if ((status = at76_get_cmd_status(priv->udev, CMD_SCAN)) < 0) {
+ status = at76_get_cmd_status(priv->udev, CMD_SCAN);
+ if (status < 0) {
err("%s: %s: at76_get_cmd_status failed with %d",
priv->netdev->name, __FUNCTION__, status);
status = CMD_STATUS_IN_PROGRESS;
@@ -2033,7 +2037,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
case 1:
at76_assert(priv->international_roaming);
- if ((ret = at76_get_mib_mdomain(priv, &mdomain)) < 0) {
+ ret = at76_get_mib_mdomain(priv, &mdomain);
+ if (ret < 0) {
err("at76_get_mib_mdomain returned %d", ret);
} else {
at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s "
@@ -2043,7 +2048,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
hex2str(mdomain.tx_powerlevel,
sizeof(mdomain.tx_powerlevel)));
}
- if ((ret = at76_start_scan(priv, 0, 1)) < 0) {
+ ret = at76_start_scan(priv, 0, 1);
+ if (ret < 0) {
err("%s: %s: start_scan (ANY) failed with %d",
priv->netdev->name, __FUNCTION__, ret);
}
@@ -2054,7 +2060,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
break;
case 2:
- if ((ret = at76_start_scan(priv, 1, 1)) < 0) {
+ ret = at76_start_scan(priv, 1, 1);
+ if (ret < 0) {
err("%s: %s: start_scan (SSID) failed with %d",
priv->netdev->name, __FUNCTION__, ret);
}
@@ -3877,7 +3884,8 @@ static int at76_open(struct net_device *netdev)
priv->last_scan = jiffies;
priv->nr_submit_rx_tries = NR_SUBMIT_RX_TRIES; /* init counter */
- if ((ret = at76_submit_rx_urb(priv)) < 0) {
+ ret = at76_submit_rx_urb(priv);
+ if (ret < 0) {
err("%s: open: submit_rx_urb failed: %d", netdev->name, ret);
goto err;
}
@@ -3988,7 +3996,8 @@ static int at76_init_new_device(struct at76_priv *priv,
at76_dbg(DBG_DEVSTART, "USB interface: %d endpoints",
interface->cur_altsetting->desc.bNumEndpoints);
- if ((ret = at76_alloc_urbs(priv, interface)) < 0)
+ ret = at76_alloc_urbs(priv, interface);
+ if (ret < 0)
goto error;
/* get firmware version */
@@ -4131,11 +4140,13 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
at76_dbg(DBG_DEVSTART, "sending REMAP");
/* no REMAP for 505A (see SF driver) */
- if (need_remap)
- if ((ret = at76_remap(udev)) < 0) {
+ if (need_remap) {
+ ret = at76_remap(udev);
+ if (ret < 0) {
err("sending REMAP failed with %d", ret);
goto end_internal_fw;
}
+ }
at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds");
schedule_timeout_interruptible(2 * HZ + 1);
@@ -4295,7 +4306,8 @@ static void at76_work_join(struct work_struct *work)
spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
if (priv->curr_bss != NULL) {
- if ((ret = at76_join_bss(priv, priv->curr_bss)) < 0) {
+ ret = at76_join_bss(priv, priv->curr_bss);
+ if (ret < 0) {
err("%s: join_bss failed with %d",
priv->netdev->name, ret);
goto end_join;
@@ -4667,7 +4679,8 @@ static void at76_work_scan(struct work_struct *work)
at76_free_bss_list(priv);
priv->scan_runs = 2;
- if ((ret = at76_start_scan(priv, 0, 1)) < 0) {
+ ret = at76_start_scan(priv, 0, 1);
+ if (ret < 0) {
err("%s: %s: start_scan failed with %d",
priv->netdev->name, __FUNCTION__, ret);
} else {
@@ -5614,7 +5627,8 @@ static void at76_rx_data(struct at76_priv *priv)
if (at76_debug & DBG_RX_DATA_CONTENT)
at76_dbg_dumpbuf("packet", skb->data + AT76_RX_HDRLEN, length);
- if ((skb = at76_check_for_rx_frags(priv)) == NULL)
+ skb = at76_check_for_rx_frags(priv);
+ if (skb == NULL)
return;
/* if an skb is returned, the at76_rx_buffer and the FCS is already removed */
@@ -5666,7 +5680,8 @@ static void at76_rx_monitor_mode(struct at76_priv *priv)
skblen = sizeof(struct at76_rx_radiotap) + length;
- if ((skb = dev_alloc_skb(skblen)) == NULL) {
+ skb = dev_alloc_skb(skblen);
+ if (skb == NULL) {
err("%s: MONITOR MODE: dev_alloc_skb for radiotap header "
"returned NULL", priv->netdev->name);
return;