Commit graph

54 commits

Author SHA1 Message Date
Matthias Beyer 64f488fb1c Staging: bcm: nvm.c: Don't pass the index
The variable 'i' does not need to be passed, as we set it to 0 (zero)
anyways when starting the iteration here.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-23 18:34:27 -07:00
Matthias Beyer 897a88d946 Staging: bcm: nvm.c: Fixed variable type
The variable type of the local variable 'j' should be 'int' instead of
'unsigned int'.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-23 18:34:27 -07:00
Matthias Beyer ae5ad41993 Staging: bcm: nvm.c: replaced member accessing with variable
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:30:42 -07:00
Matthias Beyer aabaf67f6f Staging: bcm: nvm.c: Removed indentation level by concatenating nested if statements
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:30:42 -07:00
Matthias Beyer f3ebe23705 Staging: bcm: nvm.c: Removed indentation level by using continue statement
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:30:42 -07:00
Matthias Beyer 093300f444 Staging: bcm: nvm.c: Outsourced chunk of code into function
This patch outsources a chunk of code into an own function. It also
refactors the variable names which are used within this function.

The function name may be not appropriate.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:30:41 -07:00
Matthias Beyer 3ccc0fd524 Staging: bcm: nvm.c: Shortened lines
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:30:41 -07:00
Pawel Lebioda 89fa037b82 staging: bcm: add missing blank lines after declarations
Fix "Missing blank line after declaration" warnings reported by
checkpatch.pl.

Signed-off-by: Pawel Lebioda <pawel.lebioda89@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 12:20:37 -07:00
Rickard Strandqvist c0cd6e5b1f staging: bcm: nvm.c: Cleaning up check unsigned is less than zero
Remove checking if a unsigned int is less than zero

This was found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26 21:08:46 -04:00
Rickard Strandqvist be30e7ac4f staging: bcm: nvm.c: Cleaning up a array that is filled incompletely
Array 'SigBuff' is filled incompletely.
Someone forget to multiply for the sizeof type.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 17:03:29 -07:00
Tugce Sirin 65fbed376a Staging: bcm: Remove unnecessary parentheses
This patch fixes checkpatch.pl warning Unnecessary parentheses in bcm
driver.

Signed-off-by: Tugce Sirin <ztugcesirin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-19 13:53:56 -07:00
Tugce Sirin 8fa7fdeb62 Staging: bcm: Fix sparse non-static symbol warning
Fix sparse non-static symbol warning in bcm driver.

Signed-off-by: Tugce Sirin <ztugcesirin@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-16 17:54:55 -07:00
Masanari Iida 276d30eab9 staging: bcm : Fix typo in staging/bcm
This patch fixed spelling typo in comment and printks
withing staging/bcm.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-11 12:52:42 -08:00
Rashika Kheria f5aae444ae drivers: bcm: Remove unused function in nvm.c
Remove unused function PropagateCalParamsFromEEPROMToMemory() in nvm.c.

This eliminates the following warning in nvm.c:
drivers/staging/bcm/nvm.c:1369:5: warning: no previous prototype for ‘PropagateCalParamsFromEEPROMToMemory’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-08 15:46:08 -08:00
Wenliang Fan 1b1290e5ba drivers/staging/bcm: Integer overflow
The checking condition in 'validateFlash2xReadWrite()' is not
sufficient. A large number invalid would cause an integer overflow and
pass the condition, which could cause further integer overflows in
'Bcmchar.c:bcm_char_ioctl()'.

Signed-off-by: Wenliang Fan <fanwlexca@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20 12:22:26 -08:00
Lisa Nguyen f70c8a91cd staging: bcm: Replace FALSE with false
Replace user-defined type FALSE with C defined false keyword.

Signed-off-by: Lisa Nguyen <lisa@xenapiadmin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-28 14:13:46 -07:00
Lisa Nguyen 3abd6f11cb staging: bcm: Replace BOOLEAN with bool
Remove user-defined BOOLEAN data type with C bool data
type.

Signed-off-by: Lisa Nguyen <lisa@xenapiadmin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-28 14:13:08 -07:00
Aldo Iljazi fe8c768431 Staging: bcm: nvm: fixed space prohibition
Fixed space prohibition before semicolon, particularly:

nvm.c:106: WARNING: space prohibited before semicolon
nvm.c:1098: WARNING: space prohibited before semicolon
nvm.c:1279: WARNING: space prohibited before semicolon
nvm.c:2834: WARNING: space prohibited before semicolon
nvm.c:3361: WARNING: space prohibited before semicolon
nvm.c:4453: WARNING: space prohibited before semicolon

Signed-off-by: Aldo Iljazi <neonsync1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 07:47:44 -07:00
Masanari Iida 6abaf5803d staging: bcm: Fix typo in comments
Correct spelling typo in staging/bcm

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23 10:01:43 -07:00
Mihnea Dobrescu-Balaur acb84e9ec2 staging: bcm: don't cast kzalloc() return value
Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 09:15:32 -07:00
Dan Carpenter ccbdccd4a7 Staging: bcm: add a missing break statement
My static checker complains that there is a missing break statement
here.  From the context, it does look like a break statement was
intended.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11 16:44:10 -08:00
Kevin McKinney af72c61794 Staging: bcm: Remove typedef for eNVM_TYPE and call directly.
This patch removes typedef for eNVM_TYPE, and changes
the name of the enum to bcm_nvm_type. In addition,
any calls to enum "NVM_TYPE" are changed to call
directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:56:43 -08:00
Kevin McKinney 168b14009a Staging: bcm: Remove typedef for _FLASH_CS_INFO and call directly.
This patch removes typedef for _FLASH_CS_INFO, and
changes the name of the struct to bcm_flash_cs_info.
In addition, any calls to typedefs FLASH_CS_INFO, or
*PFLASH_CS_INFO are changed to call the struct
directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:45:51 -08:00
Kevin McKinney 08391731e0 Staging: bcm: Remove typedef for _FLASH_2X_CS_INFO and call directly.
This patch removes typedef for _FLASH_2X_CS_INFO, and
changes the name of the struct to bcm_flash2x_cs_info.
In addition, any calls to typedefs FLASH2X_CS_INFO, or
*PFLASH2X_CS_INFO are changed to call the struct
directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:45:51 -08:00
Kevin McKinney 2fe119fd35 Staging: bcm: Remove typedef for _FLASH2X_VENDORSPECIFIC_INFO and call directly.
This patch removes typedef for _FLASH2X_VENDORSPECIFIC_INFO,
and changes the name of the struct to bcm_flash2x_vendor_info.
In addition, any calls to typedefs FLASH2X_VENDORSPECIFIC_INFO,
or *PFLASH2X_VENDORSPECIFIC_INFO are changed to call the
struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:45:50 -08:00
Kevin McKinney 77b54101b5 Staging: bcm: Remove typedef for _DSD_HEADER and call directly.
This patch removes typedef for _DSD_HEADER, and changes
the name of the struct to bcm_dsd_header. In addition,
any calls to typedefs DSD_HEADER, or *PDSD_HEADER are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:45:50 -08:00
Kevin McKinney be5e219dcd Staging: bcm: Remove typedef for _ISO_HEADER and call directly.
This patch removes typedef for _ISO_HEADER, and changes
the name of the struct to bcm_iso_header. In addition,
any calls to typedefs ISO_HEADER, or *PISO_HEADER are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 10:45:50 -08:00
Kevin McKinney ff4e065de1 Staging: bcm: Remove typedef for _FLASH2X_SECTION_VAL and reference directly.
This patch removes typedef for _FLASH2X_SECTION_VAL,
and changes the name of the enum to bcm_flash2x_section_val.
In addition, any calls to typedefs FLASH2X_SECTION_VAL
are changed to reference the enum directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 16:05:22 -08:00
Kevin McKinney b4a29e104a Staging: bcm: Remove typedef for _FLASH2X_READWRITE and call directly.
This patch removes typedef for _FLASH2X_READWRITE,
and changes the name of the struct to
bcm_flash2x_readwrite. In addition, any calls to
typedefs FLASH2X_READWRITE, or *PFLASH2X_READWRITE
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 16:05:22 -08:00
Kevin McKinney b1206c091b Staging: bcm: Remove typedef for _FLASH2X_COPY_SECTION and call directly.
This patch removes typedef for _FLASH2X_COPY_SECTION,
and changes the name of the struct to
bcm_flash2x_copy_section. In addition, any calls to
typedefs FLASH2X_COPY_SECTION, or *PFLASH2X_COPY_SECTION
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 16:05:21 -08:00
Kevin McKinney d48a430c2c Staging: bcm: Remove typedef for _FLASH2X_BITMAP and call directly.
This patch removes typedef for _FLASH2X_BITMAP,
and changes the name of the struct to
bcm_flash2x_bitmap. In addition, any calls
to typedefs FLASH2X_BITMAP, or *PFLASH2X_BITMAP
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 16:05:14 -08:00
Tushar Behera 8e360ec823 Staging: bcm: Fix udelay related compilation error
commit 6788d7dab6 ("Staging: bcm: Use udelay instead of msleep for
delays in nvm.c") replaces msleep with udelay values. udelay values
of more than 1000 should be replaced by mdelay instead.

This fixes following build error.
ERROR: "__bad_udelay" [drivers/staging/bcm/bcm_wimax.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

Cc: Kevin McKinney <klmckinney1@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-13 21:46:29 -07:00
Masanari Iida ae0c514cce staging: bcm: Fix typo in drivers/bcm
Correct spelling typo in drivers/bcm

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-17 09:45:37 -07:00
Kevin McKinney 85ba24d395 Staging: bcm: Change order in if conditions to make more readable in nvm.c
This patch changes the order of several if conditions
to make the code more readable.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:09:43 -07:00
Kevin McKinney a2a7ef06de Staging: bcm: Change conditions that check for NULL in nvm.c
This patch changes all conditions that check for NULL
from "if (variable == NULL)" or "if (NULL == variable)"
to "if (variable)" to make code more readable.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:09:43 -07:00
Kevin McKinney 0f20146536 Staging: bcm: Replace UINT with "unsigned int" in nvm.c
This patch replaces all uppercase UINT with "unsigned
int".

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:09:43 -07:00
Kevin McKinney 3a658a47f4 Staging: bcm: Replace INT with int in nvm.c
This patch replaces all uppercase INT with lowercase
int.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20 16:09:43 -07:00
Kevin McKinney 7dd80eb925 Staging: bcm: Return -ENOMEM instead of -1 when memory not acquired in nmv.c
This patch changes the return statement on two
conditions where memory could not be acquired.
It returns -ENOMEM instead of -1.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:50:52 -07:00
Kevin McKinney 6788d7dab6 Staging: bcm: Use udelay instead of msleep for delays in nvm.c
This patch uses udelay instead of msleep for delays
because msleep can sleep up to 20ms for any value
less than 20.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:49:53 -07:00
Kevin McKinney 7dcc1327d0 Staging: bcm: Fix ERROR: return is not a function, parentheses are not required.
This patch fixes the following error reported
by checkpatch.pl in nvm.c: "ERROR: return is
not a function, parentheses are not required".

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:49:53 -07:00
Kevin McKinney de443c96e5 Staging: bcm: Correctly format all comments in nvm.c
This patch correctly formats all comments as reported
by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:49:52 -07:00
Kevin McKinney a2940b635b Staging: bcm: Properly format braces in nvm.c
This patch cuddles braces as reported
by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:49:52 -07:00
Kevin McKinney 093abf11d3 Staging: bcm: Fix all whitespace issues in nvm.c
This patch resolves all whitespace issues as reported
by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:49:52 -07:00
Kevin McKinney 2979460d7a Staging: bcm: Remove typedef for _MINI_ADAPTER and call directly.
This patch removes typedef for _MINI_ADAPTER, changes the
name of the struct from _MINI_ADAPTER to bcm_mini_adapter.
In addition, any calls to the following typedefs
"MINI_ADAPTER, *PMINI_ADAPTER" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-04 21:09:22 -07:00
Kevin McKinney 41c7b7c0fa Staging: bcm: Fix information leak in ioctl: IOCTL_BCM_REGISTER_READ_PRIVATE, IOCTL_BCM_EEPROM_REGISTER_READ
This patch fixes an information leak in ioctl
IOCTL_BCM_REGISTER_READ_PRIVATE and
IOCTL_BCM_EEPROM_REGISTER_READ when determining
the number of bytes to copy to user space.  Function,
usb_control_msg, returns the correct number of
bytes from the hardware.  Instead of using
this value, we were using a value derived from
user space. In this case, this value could be more
than the hardware allocated.  Therefore, this
patch copies the proper number of bytes from
the hardware, and uses this value as the maximum
number of bytes for user space.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 17:11:58 -08:00
Julia Lawall e5969d5574 drivers/staging/bcm/nvm.c: add missing kfree
Buff is only used as a temporary buffer within the function, so it should
be freed before leaving the function in an error case.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@exists@
local idexpression x;
statement S,S1;
expression E;
identifier fl;
expression *ptr != NULL;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...kfree(x)...+> }
     when any
     when != true x == NULL
x->fl
...>
(
if (x == NULL) S1
|
if (...) { ... when != x
               when forall
(
 return \(0\|<+...x...+>\|ptr\);
|
* return ...;
)
}
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 15:20:53 -07:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Stephen Hemminger 4ea4f7a0d3 beceem: change startup messages
Change the regsister/unregister routines to generate better
messages, and control arrival of new frames when USB device is
unplugged.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
2010-11-01 14:06:24 -04:00
Stephen Hemminger 9dd47ee7dd beceem: make local functions static
Use namespace tool from kernel scripts to identify dead code and
functions that should be static.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
2010-11-01 12:37:05 -04:00
Stephen Hemminger 3644c1a2f1 beceem: remove dead code
Remove commented out with '#if 0'

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
2010-11-01 09:54:43 -04:00