aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8712
diff options
context:
space:
mode:
authorNarcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>2017-03-22 00:53:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-23 14:24:45 +0100
commit22d89cc86c35d510f305a5e2bb651627487d26e9 (patch)
tree1bf97b042c314aedf8c70290a7e09de7f2ba59cd /drivers/staging/rtl8712
parentstaging: rtl8712: Restructure code for clarity (diff)
downloadlinux-dev-22d89cc86c35d510f305a5e2bb651627487d26e9.tar.xz
linux-dev-22d89cc86c35d510f305a5e2bb651627487d26e9.zip
staging: rtl8712: Invert comparison to reduce indentation
Check the condition: "pdata->length < 32" first, to be able to return immediately in case of error and then continue with the rest of the function without one extra indentation level. This was found using the following Coccinelle script: @disable neg_if@ expression e,E; statement S; @@ *if (e) S else { return -E; } @disable neg_if@ expression e,E; statement S; identifier l; @@ *if (e) S else { rc = -E; goto l; } Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8712')
-rw-r--r--drivers/staging/rtl8712/rtl871x_ioctl_linux.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 3d6e818a7cc2..e30a5be5f318 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1965,13 +1965,12 @@ static int r871x_get_ap_info(struct net_device *dev,
break;
}
pdata->flags = 0;
- if (pdata->length >= 32) {
- if (copy_from_user(data, pdata->pointer, 32))
- return -EINVAL;
- data[32] = 0;
- } else {
+ if (pdata->length < 32)
return -EINVAL;
- }
+ if (copy_from_user(data, pdata->pointer, 32))
+ return -EINVAL;
+ data[32] = 0;
+
spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
phead = &queue->queue;
plist = phead->next;