public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] staging: ath6kl: cleanup in SEND_FRAME ioctl
@ 2011-02-20 12:49 Dan Carpenter
  2011-02-20 15:18 ` Vipin Mehta
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Dan Carpenter @ 2011-02-20 12:49 UTC (permalink / raw)
  To: kernel-janitors

The original code was written in a funny way where every statement was
part of else if blocks.  I broke them up into separate statements by
adding breaks on failure conditions.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c
index 5be8ea3..17ba543 100644
--- a/drivers/staging/ath6kl/os/linux/ioctl.c
+++ b/drivers/staging/ath6kl/os/linux/ioctl.c
@@ -3140,29 +3140,31 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
         case AR6000_XIOCTL_OPT_SEND_FRAME:
         {
-        WMI_OPT_TX_FRAME_CMD optTxFrmCmd;
+            WMI_OPT_TX_FRAME_CMD optTxFrmCmd;
             u8 data[MAX_OPT_DATA_LEN];
 
             if (ar->arWmiReady = false) {
                 ret = -EIO;
-            } else if (copy_from_user(&optTxFrmCmd, userdata,
-                                      sizeof(optTxFrmCmd)))
-            {
+                break;
+            }
+
+            if (copy_from_user(&optTxFrmCmd, userdata, sizeof(optTxFrmCmd))) {
                 ret = -EFAULT;
-            } else if (copy_from_user(data,
-                                      userdata+sizeof(WMI_OPT_TX_FRAME_CMD)-1,
-                                      optTxFrmCmd.optIEDataLen))
-            {
+                break;
+            }
+
+            if (copy_from_user(data, userdata+sizeof(WMI_OPT_TX_FRAME_CMD) - 1,
+                                   optTxFrmCmd.optIEDataLen)) {
                 ret = -EFAULT;
-            } else {
-                ret = wmi_opt_tx_frame_cmd(ar->arWmi,
+                break;
+            }
+
+            ret = wmi_opt_tx_frame_cmd(ar->arWmi,
                                            optTxFrmCmd.frmType,
                                            optTxFrmCmd.dstAddr,
                                            optTxFrmCmd.bssid,
                                            optTxFrmCmd.optIEDataLen,
                                            data);
-            }
-
             break;
         }
         case AR6000_XIOCTL_WMI_SETRETRYLIMITS:

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-02-22 17:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-20 12:49 [patch 1/2] staging: ath6kl: cleanup in SEND_FRAME ioctl Dan Carpenter
2011-02-20 15:18 ` Vipin Mehta
2011-02-21  4:00 ` Luis R. Rodriguez
2011-02-21  4:14 ` Greg KH
2011-02-21  4:45 ` Luis R. Rodriguez
2011-02-21  5:02 ` Greg KH
2011-02-21  5:04 ` Luis R. Rodriguez
2011-02-22 16:42 ` Joe Perches
2011-02-22 17:36 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox