Commit Graph

73 Commits

Author SHA1 Message Date
Narcisa Ana Maria Vasile e6d9379507 staging: rtl8712: Invert if statements to reduce indentation level
Invert if statements to be able to return immediately in case of error,
and to avoid additional else branch, and then continue with the rest
of the function without excessive indentation.

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>
2017-03-23 14:24:45 +01:00
Alexander Mikhalevich 3cbd227956 staging: rtl8712: Fix checkpatch.pl warning
WARNING: Avoid multiple line dereference - prefer 'param->u.crypt.key'

Signed-off-by: Alexander Mikhalevich <alex.mikhalevich@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:03 +01:00
Larry Finger fc5c13ccd9 staging: r8712u: Fix Sparse warnings in rtl871x_ioctl_linux.c
Sparse reports the following:
  CHECK   drivers/staging/rtl8712/rtl871x_ioctl_linux.c
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1422:46: warning: restricted __le16 degrades to integer
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1424:46: warning: restricted __le16 degrades to integer

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:26:55 +01:00
Joseph Wright dec9fcd032 Staging: rtl8712: fix spelling errors
Found by checkpatch:
- s/cacluated/calculated/
- s/convertor/converter/
- s/psudo/pseudo/
- s/halfs/halves/

Signed-off-by: Joseph Wright <rjosephwright@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25 11:33:21 +01:00
Jannik Becher 502c80744f staging: rtl8712: fixed little endian problem
Fixed a sparse warning.
Using function le16_to_cpus() to avoid double assignment.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 16:51:16 +01:00
Shiva Kerdel 08711b876d Staging: rtl8712: rtl871x_*: Removed unnecessary else statements after a break or return
The indent code blocks of the else statements were unnecessary
and are better written without them.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21 11:25:41 +01:00
Omri Arad 12bc1d1e9c staging: rtl8712: fix coding style error reported from checkpatch
removed the following:
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
WARNING: Statements should start on a tabstop

Signed-off-by: Omri Arad <omriarad3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 14:51:53 +02:00
Geliang Tang fcc2cf12a3 staging: rtl8712: use container_of() instead of LIST_CONTAINOR()
This patch drops the local definition of LIST_CONTAINOR(), and uses
container_of() instead of it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:53:47 -07:00
Bhaktipriya Shridhar 0b90c305c9 staging: rtl8712: rtl871x_ioctl_linux: Clean up tests if NULL returned on failure
Some functions like kmalloc/kzalloc return NULL on failure.
When NULL represents failure, !x is commonly used.

This was done using Coccinelle:

@@
expression *e;
identifier l1;
@@

e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...);
...
- e == NULL
+ !e

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alan 0c68423556 rtl871x: avoid running off end of buffer
If 32 bytes of non zero are passed in pdata->pointer then the mac_pton
function will run off the end of the buffer. Make sure we always have a
terminated string kernel side.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-05 14:48:04 -08:00
Arnd Bergmann 8c5af16f79 staging: rtl8712: reduce stack usage
The "translate_scan" function in rtl8712 uses a lot of stack, and
gets inlined into its single caller, r8711_wx_get_scan, which
in some configurations now blows the 1024 byte stack warning
limit:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'r8711_wx_get_scan':
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1227:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

This somewhat reduces the stack usage by moving the translate_scan
function out of line with the noinline_for_stack annotation.
It might be possible to modify translate_scan() a little further
to reduce the stack usage, but with this patch, we can build without
the warning, the the call chain to get here is rather predictable
(sys_ioctl->vfs_ioctl->sock_ioctl->dev_ioctl->wext_ioctl->
r8711_wx_get_scan).

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:18:33 -08:00
Dan Carpenter aea48157ce staging: rtl8712: memory corruption in wpa_set_encryption()
->KeyMaterial is declared as a 16 byte array, but we only ever allocate
either 5 or 13 bytes of it.  The problem is that we memset() all 16
bytes to zero so we're memsetting past the end of the allocated memory.

I fixed this in slightly lazy way, by just allocating 16 bytes.  This
works but there is a lot more cleanup you could do to this code if you
wanted.  Which is why this code is in staging.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:52:30 -08:00
Luis de Bethencourt 4ef2de5ae0 staging: rtl8712: spaces preferred around operands
Clean up all instances of checkpatch.pl checks:
CHECK: spaces preferred around that '+'
(and other operands)

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Luis de Bethencourt 168a2c1028 staging: rtl8712: braces should be used on all arms
Fix all instances of the following checkpatch.pl check:
CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Luis de Bethencourt 1ca96884b1 staging: rtl8712: Remove boolean comparisons
Boolean tests do not need explicit comparison to true or false.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:26:59 -07:00
Punit Vara d32c16d2fc Staging: rtl8712: Coding style warnings fix for block comments
This patch is to the rtl871x_ioctl_linux.c file that fixes up following
warnings reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Punit Vara a1b42bef0a Staging: rtl8712: Use ether_addr_equal() over memcmp()
This patch is to the rtl871x_ioctl_linux.c file that fixes up following
warning reported by checkpatch.pl :

-Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()

bssid and pnetwork->network.MacAddress both are 6 byte
array which aligned with u16

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Punit Vara e904cc8f57 Staging: rtl8712: Fix warning prefer eth_broadcast_addr() over memset()
This patch is to the rtl871x_ioctl_linux.c that fixes up following
warning by checkpatch.pl:

-Prefer eth_broadcast_addr() over memset()

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 22:15:57 -07:00
Luis de Bethencourt 681cd988d3 staging: rtl8712: fix negative level value
range->avg_qual.level is of type uint8, so it shouldn't be assigned a
negative number. Assigning it 0x100 - 78, which is the equivalent
to (20 + -98) dBm when IW_QUAL_DBM is set.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12 20:43:20 -07:00
Alison Schofield 29b1b61435 staging: rtl8712: Move constant to right of test or replace with "!"
Move constant to the right side of comparison operator or replace
equality operator (==) with the unary negation operator (!) if the
comparison is to zero.

Addesses multiple instances of the checkpatch.pl warning:
WARNING: Comparisons should place the constant on the right side of the
test

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:25:32 +01:00
Andy Shevchenko 3fe1be87ab staging: rtl8712: re-use mac_pton()
...instead of custom approach

Cc: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-02 11:48:15 +02:00
Joshua Clayton 7fb539eda2 staging: rtl8712: change SupportedRates to rates
Change the value to a name that conforms to Linux coding style.

"rates" is equally expressive in this context, and I have left alone
a comment and function name that describe the rates as supported rates.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:04 -07:00
Joshua Clayton db55b1652e staging: rtl8712: remove typedefs
Coding style fix.
Get rid of typedefs NDIS_802_11_RATES and NDIS_802_11_RATES_EX
Undo any casting that was done as a result of the typedef.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:04 -07:00
Joshua Clayton 44367877c6 staging: rtl8712: remove duplicate struct
struct ndis_wlan_bssid_ex is a doppelganger of struct wlan_bssid_ex,
and is used about a third as often.

Switch all instances to wlan_bssid_ex, and remove ndis_wlan_bssid_ex

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:14:03 -07:00
Dogukan Ergun 07e9e619db staging: rtl8712: fix else after break or return warning
This patch fixes checkpatch.pl warning.
WARNING: else is not generally useful after a break or return

Signed-off-by: Dogukan Ergun <dogukan.ergun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-13 14:45:51 -07:00
Dan Carpenter b5eed730bd staging: rtl8712: freeing an ERR_PTR
If memdup_user() fails then "pparmbuf" is an error pointer and we can't
pass it to kfree().  I changed the "goto _r871x_mp_ioctl_hdl_exit" to a
direct return.

I changed the earlier goto to a direct return as well for consistency
and removed the "pparmbuf = NULL" initializer since it's no longer
needed.

Fixes: 45de432775 ('Staging: rtl8712: Use memdup_user() instead of copy_from_user()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 01:58:04 +02:00
Julia Lawall 8f47c28b5a staging: rtl8712: Drop unneeded cast on netdev_priv
The result of netdev_priv is already implicitly cast to the type of the
left side of the assignment.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *x;
@@

x =
- (T *)
  netdev_priv(...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 15:15:40 +02:00
Cristina Opriceana 45de432775 Staging: rtl8712: Use memdup_user() instead of copy_from_user()
Use memdup_user() to avoid its duplicated implementation and simplify
code. memdup_user() uses GFP_KERNEL instead of GFP_ATOMIC,
which is valid because copy_from_user() might sleep and it's useless
to make the allocation atomic. Found with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-01 17:26:58 +02:00
Haneen Mohammed e0e982b436 Staging: rtl8712: replace memcpy with ether_addr_copy
This patch replace memcpy with ethe_addr_copy to address the following
warning generated by checkpatch.pl: ""Prefer ether_addr_copy over memcpy
if the Ethernet addresses are __aligned(2)"

Follwoing is the output of pahole for the relevant datastructures:
1- for  "iwe.u.ap_addr.sa_data" and "wrqu->ap_addr.sa_data"

struct sockaddr {
        sa_family_t                sa_family;            /*     0     2 */
        char                       sa_data[14];          /*     2    14 */

        /* size: 16, cachelines: 1, members: 2 */
        /* last cacheline: 16 bytes */
};

struct iw_event {
        __u16                      len;                  /*     0     2 */
        __u16                      cmd;                  /*     2     2 */

        /* XXX 4 bytes hole, try to pack */

        union iwreq_data           u;                    /*     8    16 */

        /* size: 24, cachelines: 1, members: 3 */
        /* sum members: 20, holes: 1, sum holes: 4 */
        /* last cacheline: 24 bytes */
};

2- for  "pnetwork->network.MacAddress" and "pcur_bss->MacAddress"

struct wlan_network {
        struct list_head           list;                 /*     0    16 */
        int                        network_type;         /*    16     4 */
        int                        fixed;                /*    20     4 */
        unsigned int               last_scanned;         /*    24     4 */
        int                        aid;                  /*    28     4 */
        int                        join_res;             /*    32     4 */
        struct ndis_wlan_bssid_ex  network;              /*    36   884 */
        /* --- cacheline 14 boundary (896 bytes) was 24 bytes ago ---   */

        /* size: 920, cachelines: 15, members: 7 */
        /* last cacheline: 24 bytes */
};

struct ndis_wlan_bssid_ex {
        u32                        Length;               /*     0     4 */
        unsigned char              MacAddress[6];        /*     4     6 */
        u8                         Reserved[2];          /*    10     2 */
        struct ndis_802_11_ssid    Ssid;                 /*    12    36 */
        u32                        Privacy;              /*    48     4 */
        s32                        Rssi;                 /*    52     4 */
        enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;  /*    56     4 */
        struct NDIS_802_11_CONFIGURATION Configuration;  /*    60    32 */
        /* --- cacheline 1 boundary (64 bytes) was 28 bytes ago --- */
        enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; /* 92     4 */
        NDIS_802_11_RATES_EX       SupportedRates;       /*    96    16 */
        u32                        IELength;             /*   112     4 */
        u8                         IEs[768];             /*   116   768 */
        /* --- cacheline 13 boundary (832 bytes) was 52 bytes ago --- */

        /* size: 884, cachelines: 14, members: 12 */
        /* last cacheline: 52 bytes */
};

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-18 10:32:39 +01:00
Aya Mahfouz 22905b8594 staging: rtl8712: replace memset(x,0,ETH_ALEN)
eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The aforementioned function replaces
memset. In addition, linux/etherdevice.h was included as a header
since it is the file that defines the inline function eth_zero_addr().
The changes were carried out using the following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:30:07 -08:00
Vaishali Thakkar 875b7dec47 Staging: rtl8712: Use mod_timer
This patch introduces the use of API function mod_timer
instead of driver specific function as it is a more
efficient and standard way to update the expire field of
an active timer.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:11:22 -08:00
Max Perepelitsyn 0636b4603f staging: rtl8712: remove spaces before commas
checkpatch.pl fix for
ERROR: space prohibited before that ',' (ctx:WxE)

Signed-off-by: Max Perepelitsyn <mperepelitsyn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 14:20:25 -08:00
Sudip Mukherjee e29d3ebcda staging: rtl8712: remove unused variables
unused variables are removed. These variables were only assigned some
values and after that they were never being used. So they are safe to
be removed , and it has been build tested.

I left a call to r8712_read32(padapter, TCR) and
r8712_read8(padapter, SDIO_HCPWM) .

r8712_read32() and r8712_read8() is ultimately calling usb_read32()
and usb_read8() respectively. and they are again calling
r8712_usbctrl_vendorreq().
this r8712_usbctrl_vendorreq() is communicating through the usb bus
and is sending and receiving the control msg.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 17:37:26 +08:00
Tapasweni Pathak 646da830fd staging: rtl8712: Remove unnecessary cast for argument of kfree
This patch removes all occurrences of unnecessary cast on the
argument to kfree, all over in rtl8712.

There is no need of the cast on the argument to kfree.

Greped to find occurrences.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:19 +08:00
Tapasweni Pathak 02a29d2d92 staging: rtl8712: add new line after declarations
This patch fixes checkpatch.pl warning in hal_init.c file
WARNING : Missing a blank line after declarations

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28 22:41:23 -04:00
Tapasweni Pathak 57b6686ebb Staging: rtl8712 : Fix line over 80 characters
This patch fixes checkpatch.pl warning in files of rtl8712
WARNING : line over 80 characters

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:14:36 -07:00
Tapasweni Pathak 730cb373f3 Staging: rtl8712: remove break after return statement
This patch fixes checkpatch.pl warning in rtl871x_ioctl_linux.c file
WARNING : break is not useful after goto or return

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 08:02:06 -07:00
James A Shackleford e99a428a1d staging: rtl8712: remove function get_list_head
get_list_head is an inline that returns &list->head.  This patch removes this
inline and directly applies &list->head where applicable.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
James A Shackleford 849fb0a887 staging: rtl8712: remove wrapper function get_next
get_next is just an inline wrapper around return list->next.  This
patch removes the wrapper and directly uses list->next where
applicable.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 20:33:16 -04:00
Rickard Strandqvist 3ae70746d0 staging: rtl8712: rtl871x_ioctl_linux.c: Cleaning up useless if statement
The same code regardless of the outcome of the if statement.
And clean up another duplicate line of code.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 16:44:06 -07:00
Vitaly Osipov 91d435fe36 staging: rtl8712: remove _malloc()
This patch removes all usage of _malloc() and the function itself. Most
uses are straightforward replacements by kmalloc(..., GFP_ATOMIC),
because this was the definition of _malloc(). In a few places it
was possible to use kzalloc() or memdup_user.

A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL
where possible.

Verified by compilation only.

Initial replacement done by running a Coccinelle script along the lines
of:

@@
type T;
expression E;
identifier V;
@@
- V = (T) _malloc(E);
+ V = kmalloc(E, GFP_ATOMIC);

@@
expression E, E1;
@@
- E1 = _malloc(E);
+ E1 = kmalloc(E, GFP_ATOMIC);

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25 11:04:44 -07:00
Christian Engelmayer 55d4f6cc4c staging: rtl8712: fix potential leak in r871x_wx_set_enc_ext()
Fix a potential leak in the error path of r871x_wx_set_enc_ext(). In case the
requested algorithm is not supported by the driver, the function returns
without freeing the already allocated 'param' struct. Move the input
verification to the beginning of the function so that the direct return is
safe. Detected by Coverity - CID 144373.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:14 +09:00
Paul Gortmaker 885a947e5b staging: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17 10:08:14 -08:00
Thomas Cort 77e73e8c90 Staging: rtl8712: fix spaces before semicolons
Resolve all of the 'WARNING: space prohibited before semicolon'
checkpatch warnings for rtl8712.

Signed-off-by: Thomas Cort <linuxgeek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:50:54 -07:00
Andy Shevchenko 87fa05e8ab staging: rtl8712: return MAC in standard form
MAC respresentation should follow standard form.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23 14:52:19 -07:00
Przemo Firszt 0024a1e734 rtl8712: replace min with min_t
I've changed the ugly casting here and used min_t() instead.  I
also changed the u16 to a u32 because ->network.Ssid.SsidLength
is 32 bits.  It doesn't make a difference, but truncating the
upper bits away is sloppy.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11 16:39:11 -08:00
Przemo Firszt 87a573ada0 rtl8712: replace printk with better solutions
Replace printk with netdev_printk helpers, dev_printk helpers or
pr_err/warn/info if there is no device info available.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11 16:39:11 -08:00
Cyril Roelandt 2df29e7bf2 staging: rtl8712: avoid a useless call to memset().
In r8711_wx_get_wap(), make sure we do not call memcpy() on a memory area that
has just been zeroed by a call to memset().

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 14:53:58 -08:00
Wei Yongjun 605fba82a2 staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start()
The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:30:01 -07:00
Wei Yongjun 779477f296 staging: r8712u: use is_broadcast_ether_addr() to simplify the code
Using is_broadcast_ether_addr() to simplify the code.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-04 14:03:40 -07:00