openwrt/staging/blogic.git
7 years agostaging: bcm2835-audio: use conditional only for error case
Aishwarya Pant [Sun, 12 Mar 2017 15:39:31 +0000 (21:09 +0530)]
staging: bcm2835-audio: use conditional only for error case

* Refactor conditional to check if memory allocation has failed and
immediately return (-ENOMEM); if block for success case is removed.

* Return the error value -EBUSY when queue_work() fails.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-audio: propagate PTR_ERR value instead of -EPERM
Aishwarya Pant [Sun, 12 Mar 2017 15:39:14 +0000 (21:09 +0530)]
staging: bcm2835-audio: propagate PTR_ERR value instead of -EPERM

It is better to propagate PTR_ERR value instead of a hardcoded value
(-EPERM here)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-audio: replace null with error pointer value
Aishwarya Pant [Sun, 12 Mar 2017 15:39:00 +0000 (21:09 +0530)]
staging: bcm2835-audio: replace null with error pointer value

This patch replaces NULL values returned by vc_vchi_audio_init(...) with
error pointer values:
- Return ERR_PTR(-EINVAL) when too many instances of audio
  service are initialised
- Return ERR_PTR(-ENOMEM) when kzalloc fails
- RETURN ERR_PTR(-EPERM) when vchi connections fail to open

Similarly, a NULL check where vc_vchi_audio_init(...) is called is
replaced by IS_ERR(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-audio: Replace kmalloc with kzalloc
Aishwarya Pant [Sun, 12 Mar 2017 15:38:43 +0000 (21:08 +0530)]
staging: bcm2835-audio: Replace kmalloc with kzalloc

Replace kmalloc and memset with kzalloc.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: Alignment should match open parenthesis
Arushi Singhal [Mon, 13 Mar 2017 20:48:49 +0000 (02:18 +0530)]
staging: sm750fb: Alignment should match open parenthesis

Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: fixes add blank line after function/struct/union/enum declarations
Arushi Singhal [Mon, 13 Mar 2017 20:48:48 +0000 (02:18 +0530)]
staging: sm750fb: fixes add blank line after function/struct/union/enum declarations

This patch fixes the warnings reported by checkpatch.pl
for please use a blank line after function/struct/union/enum
declarations.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: function prototype argument should have an identifier name
Arushi Singhal [Mon, 13 Mar 2017 20:48:47 +0000 (02:18 +0530)]
staging: sm750fb: function prototype argument should have an identifier name

function prototype arguments like 'struct vb_device_info *','unsigned
long' etc. should have an identifier name.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: remove explicit cast
Tobin C. Harding [Mon, 13 Mar 2017 01:37:34 +0000 (12:37 +1100)]
staging: dgnc: remove explicit cast

Function return type is 'int'. Returned variable is of type
'uint'. uint can be implicitly converted to int. Most significant bit
is not set so there is no risk in implicit conversion.

Remove unnecessary type cast.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: fix whitespace before return
Tobin C. Harding [Mon, 13 Mar 2017 01:37:33 +0000 (12:37 +1100)]
staging: dgnc: fix whitespace before return

Checkpatch emits CHECK: Blank lines aren't necessary before a close
brace '}'. Previous attempts were made to make uniform the error
handling in dgnc but improvements are still possible.

Undo whitespace changes that should not have been made :(. Make return
statement placement uniform throughout dgnc. Fix checkpatch
CHECK. Make whitespace changes only.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: return error code directly
Tobin C. Harding [Mon, 13 Mar 2017 01:37:32 +0000 (12:37 +1100)]
staging: dgnc: return error code directly

In various functions a return code variable is defined at the top of
function, for example;

rc = -ENODEV;

and then the variable is returned. This makes it harder to read since
it separates the error code from the return site.

Return the error code directly instead of using a variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: amplc_pci224: Convert macro GAT_CONFIG to static inline function
simran singhal [Sun, 12 Mar 2017 16:55:42 +0000 (22:25 +0530)]
staging: comedi: amplc_pci224: Convert macro GAT_CONFIG to static inline function

Convert macro GAT_CONFIG to static inline function as static inline
functions are preferred over macros. This change is possible since the
arguments at all call sites have the same type.

The uses were updated with Coccinelle:

@r1@
expression dev,reg,chan,src;
@@
-GAT_CONFIG(chan, src)
+pci224_gat_config(chan, src)

Also, the comment describing the macro has been removed.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: Compress return logic into one line.
Varsha Rao [Sun, 12 Mar 2017 15:07:30 +0000 (20:37 +0530)]
staging: comedi: Compress return logic into one line.

Simplify function return by merging assignment and return into a single
line. The following coccinelle script is used to fix this issue.

@@
expression e;
local idexpression ret;
@@

-ret = e;
-return ret;
+return e;

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre shorten multiple lines over 80 char in lu_object.h
Craig Inches [Sun, 12 Mar 2017 19:18:40 +0000 (19:18 +0000)]
staging: lustre shorten multiple lines over 80 char in lu_object.h

This patch adjusts lines so that they are less than 80 char.
Checkpatch.pl idenitified the issue.

Signed-off-by: Craig Inches <Craig@craiginches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: convert vme_user_vma_priv.refcnt from atomic_t to refcount_t
Elena Reshetova [Mon, 6 Mar 2017 14:21:10 +0000 (16:21 +0200)]
drivers: convert vme_user_vma_priv.refcnt from atomic_t to refcount_t

refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: android: ion: ion_dummy_driver: remove unnecessary empty line
Maciej Billewicz [Mon, 13 Mar 2017 21:32:19 +0000 (22:32 +0100)]
Staging: android: ion: ion_dummy_driver: remove unnecessary empty line

Fix coding style issue.

Signed-off-by: Maciej Billewicz <maciej.billewicz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add parentheses to complex macro
Tobin C. Harding [Mon, 13 Mar 2017 07:54:08 +0000 (18:54 +1100)]
staging: ks7010: add parentheses to complex macro

Checkpatch emits ERROR: Macros with complex values should be enclosed
in parentheses. Error may be fixed by adding parentheses around macro
definition, macros are simple arithmetic statement.

Add parentheses around macro definitions. Fix 24 cases of identical
error. Do commented out macros also to save the next developer from
having to add them.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch whitespace warns
Tobin C. Harding [Mon, 13 Mar 2017 07:54:07 +0000 (18:54 +1100)]
staging: ks7010: fix checkpatch whitespace warns

Checkpatch emits various warnings, errors and checks;

 ERROR:TRAILING_WHITESPACE: trailing whitespace
 WARNING:SPACE_BEFORE_TAB: please, no space before tabs
 WARNING:SPACE_BEFORE_TAB: please, no space before tabs
 ERROR:CODE_INDENT: code indent should use tabs where possible
 CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis

These are all trivial whitespace fixes. Fix them all in one
patch. Change only whitespace.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add variables key, key_index
Tobin C. Harding [Mon, 13 Mar 2017 06:38:22 +0000 (17:38 +1100)]
staging: ks7010: add variables key, key_index

'auth_type - 1' is used as an index into a key table. Adding a variable
appropriately named simplifies the code and adds meaning when
reading. Adding a pointer variable of type struct *kpa_key_t adds to
readability by removing the table access each time the key is used.

The key index is used to create a string so having it named adds
additional meaning when creating the string.

Declare variable 'key_index' and define it at declaration time. Declare
a pointer variable 'key' and define it to point to the correct key in
the key table.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: reduce length of comment string
Tobin C. Harding [Mon, 13 Mar 2017 06:38:21 +0000 (17:38 +1100)]
staging: ks7010: reduce length of comment string

Comment string is unnecessarily verbose. Checkpatch emits WARNING:
line over 80 characters.

Reduce comment string without loss of meaning.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move quoted string onto single line
Tobin C. Harding [Mon, 13 Mar 2017 06:38:20 +0000 (17:38 +1100)]
staging: ks7010: move quoted string onto single line

Checkpatch emits WARNING: quoted string split across lines. Line is
already over 80 characters long, adding 3 more does little to effect
line length while improving readibility.

Concatenate split string into single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: refactor newly separated function
Tobin C. Harding [Mon, 13 Mar 2017 06:38:19 +0000 (17:38 +1100)]
staging: ks7010: refactor newly separated function

Checkpatch emits various warnings and checks;

WARNING: Avoid multiple line dereference
CHECK: Alignment should match open parenthesis
WARNING: line over 80 characters
CHECK: Blank lines aren't necessary before a close brace '}'

These are all whitespace fixes.

Refactor whitespace inline with kernel coding style. Fix various
checkpatch warnings.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix line continuations
Tobin C. Harding [Mon, 13 Mar 2017 06:38:18 +0000 (17:38 +1100)]
staging: ks7010: fix line continuations

Checkpatch emits CHECK: Logical continuations should be on the
previous line. Also the same code section causes checkpatch to emit
WARNING: Avoid multiple line dereference.

Move logical line continuations onto the previous line. Move multiple
line dereferences onto single line.

Make these two changes in a single patch to give review a chance
to critique the final layout of the *complex* logical statement.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: reduce level of indentation
Tobin C. Harding [Mon, 13 Mar 2017 06:38:17 +0000 (17:38 +1100)]
staging: ks7010: reduce level of indentation

Code is deeply nested. One level of indentation may be removed by
inverting if statement conditional.

Invert conditional, return if new conditional evaluates to true.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move WPA code to separate function
Tobin C. Harding [Mon, 13 Mar 2017 06:38:16 +0000 (17:38 +1100)]
staging: ks7010: move WPA code to separate function

Checkpatch emits WARNING: Too many leading tabs - consider code
refactoring. Function contains 5 levels of nesting and 14 local
variables. Code can be simplified and nesting reduced by refactoring
into separate functions.

WPA code is contained and may be factored out into a separate
function. This will reduce the length and complexity of
hostif_data_indication(). At times within the WPA code errors result
in the function returning. In order to maintain this behaviour new
function should return a status integer.

Factor out WPA code into separate function. Add only code needed to
get compilation to pass, including modifying return statements. Make
no other code changes, program logic is unchanged.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospeakup: Support spelling unicode characters
Samuel Thibault [Mon, 13 Mar 2017 00:17:14 +0000 (01:17 +0100)]
speakup: Support spelling unicode characters

This supports spelling unicode characters by just passing them to
the speech synthesis in direct mode.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospeakup: make get_char actually get unicode characters
Samuel Thibault [Mon, 13 Mar 2017 00:17:13 +0000 (01:17 +0100)]
speakup: make get_char actually get unicode characters

9831013cbdbd3d06430a1db01d8c32d50c7d1c04 ('speakup: convert screen
reading to 16bit characters') paved the way for handling unicode
characters in speakup, but for the review mode, it missed actually
getting unicode characters from the VC. This fixes by just turning the
use_unicode parameter to 1.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Zahari Yurukov <zahari.yurukov@gmail.com>
Reviewed-by: Chris Brannon <chris@the-brannons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: fix "Alignment match open parenthesis"
Arushi Singhal [Mon, 13 Mar 2017 20:40:18 +0000 (02:10 +0530)]
staging: speakup: fix "Alignment match open parenthesis"

Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: media: davinci_vpfe - style fix
Derek Robson [Fri, 10 Feb 2017 22:28:25 +0000 (11:28 +1300)]
Staging: media: davinci_vpfe - style fix

Fixed alignment of block commenents across whole driver.
Found using checkpatch.

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: media: lirc - style fix
Derek Robson [Sat, 11 Feb 2017 00:42:38 +0000 (13:42 +1300)]
Staging: media: lirc - style fix

Changed permissions to octal across whole driver
Found by checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: android: ion: Replace pr_err with dev_err
simran singhal [Mon, 13 Mar 2017 13:56:24 +0000 (19:26 +0530)]
staging: android: ion: Replace pr_err with dev_err

All devm functions has a device structure as the first argument which is
required by dev_{err,info,dbg} printing functions.
This patch converts pr_err to dev_err as dev_* is preferred after calls
to devm functions.

Done using coccinelle:

@r1 exists@
expression e,e1;
identifier f =~ "^devm_";
identifier g =~ "^pcim_";
identifier h =~ "^dmam_";
@@
e=\(f\|g\|h\)(e1,...);
<+...
(
- pr_info(
+ dev_info(e1,
   ...);
|
- pr_err(
+ dev_err(e1,
  ...);
|
- pr_debug(
+ dev_dbg(e1,
  ...);
)
...+>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: i18n.c: Refactor conditionals in spk_msg_set
Narcisa Ana Maria Vasile [Thu, 9 Mar 2017 22:53:44 +0000 (00:53 +0200)]
staging: speakup: i18n.c: Refactor conditionals in spk_msg_set

Reduce the indentation level in spk_msg_set and remove
unnecessary return variable.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: speakup: i18n.c: Change return type from int to bool
Narcisa Ana Maria Vasile [Thu, 9 Mar 2017 22:53:23 +0000 (00:53 +0200)]
staging: speakup: i18n.c: Change return type from int to bool

The possible return values (0 or 1) for compare_specifiers
and fmt_validate represent whether a condition holds or not, so
conceptually, they are booleans.

Update documentation for these two functions.

Change type of variable 'still_comparing' from int to bool too,
inside fmt_validate, because it is intended to hold truth values
as well.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: Fix redundant space coding style issue
Alex Yashchenko [Sat, 11 Mar 2017 17:13:24 +0000 (20:13 +0300)]
staging: rtl8188eu: Fix redundant space coding style issue

Signed-off-by: Alex Yashchenko <alexhoppus111@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8712: fix bad indentation
Thibaut SAUTEREAU [Sat, 11 Mar 2017 18:27:27 +0000 (19:27 +0100)]
staging: rtl8712: fix bad indentation

Fix bad indentation as reported by checkpatch.pl script.

Signed-off-by: Thibaut SAUTEREAU <thibaut.sautereau@telecom-sudparis.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vt6655: baseband: Add identifier name to function definition argument
sayli karnik [Fri, 10 Mar 2017 12:29:04 +0000 (17:59 +0530)]
staging: vt6655: baseband: Add identifier name to function definition argument

The patch resolves the checkpatch warning:
WARNING: function definition argument should also have an identifier name

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: css2400/sh_css: Remove parentheses from return arguments
simran singhal [Fri, 10 Mar 2017 13:07:23 +0000 (18:37 +0530)]
staging: css2400/sh_css: Remove parentheses from return arguments

The sematic patch used for this is:
@@
identifier i;
constant c;
@@
return
- (
    \(i\|-i\|i(...)\|c\)
- )
  ;

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sh_css_firmware: Remove parentheses from return arguments
simran singhal [Fri, 10 Mar 2017 13:07:24 +0000 (18:37 +0530)]
staging: sh_css_firmware: Remove parentheses from return arguments

The sematic patch used for this is:
@@
identifier i;
constant c;
@@
return
- (
    \(i\|-i\|i(...)\|c\)
- )
  ;

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: wlan-ng: Fix endian error
Adrien Descamps [Thu, 9 Mar 2017 20:15:19 +0000 (21:15 +0100)]
Staging: wlan-ng: Fix endian error

sparse report fixed:
drivers/staging//wlan-ng//hfa384x_usb.c:3517:35: warning: restricted __be64 degrades to integer
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33: warning: incorrect type in assignment (different base types)
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33:    expected restricted __be64 [usertype] mactime
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33:    got unsigned long long

Computation on the value should be done when in machine format, not in big endian format.

Signed-off-by: Adrien Descamps <adrien.descamps@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: wlan-ng: Fix sparse warnings by using appropriate endian types
Adrien Descamps [Thu, 9 Mar 2017 20:15:18 +0000 (21:15 +0100)]
Staging: wlan-ng: Fix sparse warnings by using appropriate endian types

Fix some sparse warning by using correct endian types in structs and
local variables.
This patch only fix sparse warnings and do not change the logic.

Signed-off-by: Adrien Descamps <adrien.descamps@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: xgifb: XGI_main_26.c: non-standard C
Manoj Sawai [Thu, 9 Mar 2017 19:03:18 +0000 (00:33 +0530)]
Staging: xgifb: XGI_main_26.c: non-standard C

Fixes following checkpatch warning:

"WARNING: %Lx is non-standard C, use %llx"

Signed-off-by: Manoj Sawai <mas@iitkgp.ac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: bcm2835: Fixed style of block comments
Derek Robson [Sat, 11 Mar 2017 03:01:59 +0000 (16:01 +1300)]
Staging: bcm2835: Fixed style of block comments

Fixed style of block comments across whole driver
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: remove anonymous field declarations
Aishwarya Pant [Fri, 10 Mar 2017 16:39:27 +0000 (22:09 +0530)]
staging: bcm2835-camera: remove anonymous field declarations

Anonymous field declarations are error prone. This patch replaces
anonymous declarations with explicit field declarations for typedef
SERVICE_CREATION_T in vchiq_mmal_init(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-audio: remove anonymous field declarations
Aishwarya Pant [Fri, 10 Mar 2017 16:39:11 +0000 (22:09 +0530)]
staging: bcm2835-audio: remove anonymous field declarations

Anonymous field declarations are error prone. This patch replaces
anonymous declarations with explicit field declarations for typedef
SERVICE_CREATION_T in vc_vchi_audio_init(..)

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: ks7010: ks_hostif.*: Use preferred 'u32' kernel type over 'uint32_t'
Shiva Kerdel [Sun, 12 Mar 2017 02:30:01 +0000 (03:30 +0100)]
Staging: ks7010: ks_hostif.*: Use preferred 'u32' kernel type over 'uint32_t'

Fix prefer kernel type 'u32' over 'uint32_t' checks.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: ks7010: ks_hostif.*: Use preferred 'u16' kernel type over 'uint16_t'
Shiva Kerdel [Sun, 12 Mar 2017 02:30:00 +0000 (03:30 +0100)]
Staging: ks7010: ks_hostif.*: Use preferred 'u16' kernel type over 'uint16_t'

Fix prefer kernel type 'u16' over 'uint16_t' checks.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: ks7010: ks_*: Use preferred 'u8' kernel type over 'uint8_t'
Shiva Kerdel [Sun, 12 Mar 2017 02:29:59 +0000 (03:29 +0100)]
Staging: ks7010: ks_*: Use preferred 'u8' kernel type over 'uint8_t'

Fix prefer kernel type 'u8' over 'uint8_t' checks.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: change module description
Ian Abbott [Wed, 8 Mar 2017 18:44:33 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: change module description

Change the MODULE_DESCRIPTION string from the generic "Comedi low-level
driver" to the more specific "Comedi driver for JR3/PCI force sensor
board".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: fix initial range[8] max value
Ian Abbott [Wed, 8 Mar 2017 18:44:32 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: fix initial range[8] max value

`jr3_pci_alloc_spriv()` initializes `spriv->range[8]` to use a maximum
value of 65536, but that will be overwritten with 65535 at a later time
by `jr3_pci_poll_subdevice()` once the "set full scales" command is
complete.  The initial setting looks like a mistake.  This range is only
associated with a couple of dummy channels (channels 56 and 57) to read
back the model number and serial number, so no user code should be
attempting to convert those numbers to physical units.  Just change the
initial value to 65535 to match the final value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: check PCI BAR 0 size
Ian Abbott [Wed, 8 Mar 2017 18:44:31 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: check PCI BAR 0 size

The various supported boards have different numbers of subdevices from 1
to 4.  Each subdevice needs a block of registers in PCI BAR 0.  Check
the region is large enough for the required number of subdevices.
Return an error from `jr3_pci_auto_attach()` if it is too small.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: check sizes at compile time
Ian Abbott [Wed, 8 Mar 2017 18:44:30 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: check sizes at compile time

The driver currently checks the size of `struct jr3_sensor` is correct
when a device is attached, returning an error if it is wrong.  Replace
that with a compile-time check.  We don't care too much about the size
of `struct jr3_sensor` as it is embedded in the larger `struct
jr3_block` and is followed by a lot of padding.  We should care more
that the size of `struct jr3_block` is correct, as it describes the
overall register layout of a block, and there is an array of such blocks
(one per subdevice).  Check its size at compile-time using the
`BUILD_BUG_ON()` macro.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: omit pointless debug info
Ian Abbott [Wed, 8 Mar 2017 18:44:29 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: omit pointless debug info

`jr3_pci_open()` outputs several debug log messages containing serial
numbers of the sensors (one per subdevice) along with a pointer to the
subdevice private data structure.  The latter is of no use, so reformat
the debug log to omit it.

`jr3_pci_alloc_spriv()` outputs a debug log message containing more
useless information about the remapped base address of the board
registers, the sensor registers, and the difference between them.  Get
rid of it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: use struct jr3_block instead of jr3_t
Ian Abbott [Wed, 8 Mar 2017 18:44:28 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: use struct jr3_block instead of jr3_t

`struct jr3_t` contains a single array member `block` of member type
`struct jr3_block`.  Rather than using pointers to `struct jr3_t`, just
use pointers to `struct jr3_block` instead and treat it as an array.
Replace the local variables `struct jr3_t __iomem *iobase` with `struct
jr3_block __iomem *block`.  Remove the definition of `struct jr3_t` as
it is no longer needed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: separate out block type
Ian Abbott [Wed, 8 Mar 2017 18:44:27 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: separate out block type

`struct jr3_t` contains a single array member `block` of a tag-less
`struct` type.  Rename the tag-less `struct` type to `struct jr3_block`
and move its definition outside of `struct jr3_t`.  This will allow us
to use pointers of this type.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: rename 'channel' to 'block'
Ian Abbott [Wed, 8 Mar 2017 18:44:26 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: rename 'channel' to 'block'

The term "channel" is overloaded in this driver.  Rename the `channel`
member of `struct jr3_t` to `block` to reduce confusion.  `block` is an
array of an anonymous `struct` type, with each element covering the
registers for one subdevice.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: rename data to sensor
Ian Abbott [Wed, 8 Mar 2017 18:44:25 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: rename data to sensor

Rename the `channel[x].data` member of `struct jr3_t` to
`channel[x].sensor` to match its type `struct jr3_sensor`.  Also rename
local variable `ch0data` in `jr3_pci_show_copyright()` to `sensor0` for
consistency.  It points to the `struct jr3_sensor` embedded in the
registers for "channel" 0.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: rename channel to sensor
Ian Abbott [Wed, 8 Mar 2017 18:44:24 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: rename channel to sensor

The driver overloads the term "channel" a lot.  To help reduce
confusion, rename the `channel` member of `struct
jr3_pci_subdev_private` to `sensor` as it points to a `struct
jr3_sensor`.  Also rename the various function parameters and local
variables called `channel` that point to a `struct jr3_sensor` to
`sensor`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: jr3_pci: rename struct jr3_channel to jr3_sensor
Ian Abbott [Wed, 8 Mar 2017 18:44:23 +0000 (18:44 +0000)]
staging: comedi: jr3_pci: rename struct jr3_channel to jr3_sensor

The driver overloads the term "channel" a lot.  To help reduce
confusion, rename `struct jr3_channel` to `struct jr3_sensor`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: clean up return logic, remove redunant code
Colin Ian King [Sat, 11 Mar 2017 19:32:05 +0000 (19:32 +0000)]
staging: atomisp: clean up return logic, remove redunant code

There is no need to check if ret is non-zero, remove this
redundant check and just return the error status from the call
to mt9m114_write_reg_array.

Detected by CoverityScan, CID#1416577 ("Identical code for
different branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: remove redundant check for client being null
Colin Ian King [Sat, 11 Mar 2017 19:48:19 +0000 (19:48 +0000)]
staging: atomisp: remove redundant check for client being null

The previous statement checks if client is null, so the null check
when assigning dev is redundant and can be removed.

Detected by CoverityScan, CID#1416555 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp_fops: Clean up tests if NULL returned on failure
simran singhal [Fri, 10 Mar 2017 05:13:10 +0000 (10:43 +0530)]
staging: atomisp_fops: 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: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vpfe_mc_capture: Clean up tests if NULL returned on failure
simran singhal [Fri, 10 Mar 2017 05:13:11 +0000 (10:43 +0530)]
staging: vpfe_mc_capture: 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: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lirc_zilog: Clean up tests if NULL returned on failure
simran singhal [Fri, 10 Mar 2017 05:13:12 +0000 (10:43 +0530)]
staging: lirc_zilog: 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: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: media: atomisp: remove '.' from pci Makefile
Greg Kroah-Hartman [Sun, 12 Mar 2017 13:51:52 +0000 (14:51 +0100)]
staging: media: atomisp: remove '.' from pci Makefile

Remove the odd './' usage in the Makefile to make the build output a bit
more sane looking and match the normal kernel build style.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove FPGA defines
Alan Cox [Fri, 10 Mar 2017 11:35:17 +0000 (11:35 +0000)]
atomisp: remove FPGA defines

These are not relevant to an upstream kernel driver.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove pdaf kernel
Alan Cox [Fri, 10 Mar 2017 11:35:06 +0000 (11:35 +0000)]
atomisp: remove pdaf kernel

This is not used on either Baytrail or Cherrytrail so can simply be deleted

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: tidy firmware loading code a little
Alan Cox [Fri, 10 Mar 2017 11:34:41 +0000 (11:34 +0000)]
atomisp: tidy firmware loading code a little

The FWNAME define is never used so can be removed. The option to skip firmware
loading isn't really Cherrytrail specific so remove this and complete the
merging of the two driver versions for this file.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: eliminate intel_mid_pm.h
Alan Cox [Fri, 10 Mar 2017 11:34:27 +0000 (11:34 +0000)]
atomisp: eliminate intel_mid_pm.h

We can do this because the only thing it is used for is identifying the
platform for power management purposes. The driver only supports Baytrail
and Cherrytrail and both of those always need the IPU to be power managed
directly not via PCI D3 states.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove C_RUN define and code
Alan Cox [Fri, 10 Mar 2017 11:34:11 +0000 (11:34 +0000)]
atomisp: remove C_RUN define and code

We are not going to be building for anything but Linux so the code bracketed
by C_RUN is not used and not needed.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove HIVECC
Alan Cox [Fri, 10 Mar 2017 11:33:59 +0000 (11:33 +0000)]
atomisp: remove HIVECC

We are only going to be building for Linux with gcc, so we can lose bits of
material related to other build targets.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove unused code and unify a header
Alan Cox [Fri, 10 Mar 2017 11:33:45 +0000 (11:33 +0000)]
atomisp: remove unused code and unify a header

KLOCWORK is never defined so we can remove the workarounds for this in the
code.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove dead code for SSSE3
Alan Cox [Fri, 10 Mar 2017 11:33:33 +0000 (11:33 +0000)]
atomisp: remove dead code for SSSE3

This is another define which is never used and references a header that doesn't
exist, so consider it dead. Our memcpy is pretty smart anyway.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Remove multiple assignments
Gargi Sharma [Sat, 11 Mar 2017 14:57:20 +0000 (20:27 +0530)]
staging: rtl8192e: Remove multiple assignments

This patch removes multiple assignments by factorizing them.
This was done with Coccinelle for the if branch. For the else part
the change was done manually. Braces were also added to the
else part to remove the checkpatch warning, "braces should be
on all arms of if-else statements".

@ identifier i1,i2; constant c; @@
- i1=i2=c;
+ i1=c;
+ i2=c;

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192u: Remove typedef phy_ofdm_rx_status_rxsc_sgien_exintfflag
simran singhal [Sat, 11 Mar 2017 17:21:00 +0000 (22:51 +0530)]
staging: rtl8192u: Remove typedef phy_ofdm_rx_status_rxsc_sgien_exintfflag

Remove typdef phy_ofdm_rx_status_rxsc_sgien_exintfflag and replace its uses
in the code.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: Use min3 macro
Gargi Sharma [Sat, 11 Mar 2017 20:41:37 +0000 (02:11 +0530)]
staging: lustre: Use min3 macro

Replace comparsions between three expressions using
two min macros with min3 macro. Done using Coccinelle
Script:

@@
expression e1;
expression e2;
expression e3;
@@
(
- min(min(e1, e2), e3)
+ min3(e1, e2, e3)
|
- min(e1, min(e2, e3))
+ min3(e1, e2, e3)
)

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: remove item from TODO list
Tobin C. Harding [Tue, 7 Mar 2017 09:57:04 +0000 (20:57 +1100)]
staging: dgnc: remove item from TODO list

TODO file contains task to verify and correct function return
sites. Need to check for and implement correct usage of goto's when
there is work to be done before returning.

Remove task from TODO list after already having completed audit of
directory drivers/staging/dgnc.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: audit goto's in dgnc_tty
Tobin C. Harding [Tue, 7 Mar 2017 09:57:03 +0000 (20:57 +1100)]
staging: dgnc: audit goto's in dgnc_tty

TODO file requests fix up of error handling.

Audit dgnc_mgmt.c and fix all return paths to be uniform and inline
with kernel coding style.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: audit goto's in dgnc_mgmt
Tobin C. Harding [Tue, 7 Mar 2017 09:57:02 +0000 (20:57 +1100)]
staging: dgnc: audit goto's in dgnc_mgmt

TODO file requests fix up of error handling.

Audit dgnc_mgmt.c and fix all return paths to be uniform and inline
with kernel coding style.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: audit goto's in dgnc_driver
Tobin C. Harding [Tue, 7 Mar 2017 09:57:01 +0000 (20:57 +1100)]
staging: dgnc: audit goto's in dgnc_driver

TODO file requests fix up of error handling.

Audit dgnc_driver.c and fix all return paths to be uniform and inline
with kernel coding style.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vchi: Remove ARM64 from TODO list
Michael Zoran [Fri, 10 Mar 2017 07:41:10 +0000 (23:41 -0800)]
staging: vchi: Remove ARM64 from TODO list

ARM64 for core vchiq which is the core of vc04_services should
now be work complete.  The driver compiles without any errors
or warnings, and works just as well as 32 bit mode.  The
necessary compatibility wrappers for the 32 bit ioctls have been
written and merged.

Since no more ARM64 specific changes should be needed, perhaps
it's best to remove it from the TODO list.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: use kernel preferred style for handling errors
Aishwarya Pant [Thu, 9 Mar 2017 19:01:36 +0000 (00:31 +0530)]
staging: bcm2835-camera: use kernel preferred style for handling errors

This patch replaces NULL error values with error pointer values.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: replace kmalloc with kzalloc
Aishwarya Pant [Thu, 9 Mar 2017 19:01:20 +0000 (00:31 +0530)]
staging: bcm2835-camera: replace kmalloc with kzalloc

This patch replaces kmalloc and memset with kzalloc

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: add check to avoid null pointer dereference
Aishwarya Pant [Thu, 9 Mar 2017 19:00:58 +0000 (00:30 +0530)]
staging: bcm2835-camera: add check to avoid null pointer dereference

This patch adds checks after memory allocation to avoid possible null
pointer dereferences.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: remove depends on ARM
Michael Zoran [Fri, 10 Mar 2017 05:08:59 +0000 (21:08 -0800)]
staging: bcm2835-camera: remove depends on ARM

Since all the arm64 specific issues have been fixed now
and the camera is working fine with a arm64 kernel, the
depends on ARM can be removed from Kconfig.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Fix bogus compiler warnings regarding constants
Michael Zoran [Fri, 10 Mar 2017 05:08:58 +0000 (21:08 -0800)]
staging: bcm2835-camera: Fix bogus compiler warnings regarding constants

In debug logging code, the compiler is warning about imposible
situations and size of constants not matching the format specifier.

This change fixes all three instances of this.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Fix buffer overflow calculation on query of camera properties
Michael Zoran [Fri, 10 Mar 2017 05:08:57 +0000 (21:08 -0800)]
staging: bcm2835-camera: Fix buffer overflow calculation on query of camera properties

The code that queries properties on the camera has a check
for buffer overruns if the firmware sends too much data.  This
check is incorrect, and during testing I was seeing stack corruption.

I believe this error can actually happen in normal use, just for
some reason it doesn't appear on 32 bit as often.  So perhaps
it's best for the check to be fixed.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert spinlock to mutex in handle mapping code
Michael Zoran [Fri, 10 Mar 2017 05:08:56 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert spinlock to mutex in handle mapping code

The handle mapping code that converts context pointers to handles uses
a spinlock.  Since the btree implementation can sleep while allocating
memory, turning on several kernel debugging options will result in
errors in the log.

Since this code path is never called in atomic context, perhaps it's
better to just use a mutex.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert struct mmal_buffer_header info fields to u32
Michael Zoran [Fri, 10 Mar 2017 05:08:55 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert struct mmal_buffer_header info fields to u32

The struct mmal_buffer_header has multiple fields used for informational
and debugging purposes.  These are safe to convert to u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert struct mmal_port info fields to u32
Michael Zoran [Fri, 10 Mar 2017 05:08:54 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert struct mmal_port info fields to u32

The struct mmal_port has a few informational fields. Convert these to
u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert client_context field to a 32 bit handle
Michael Zoran [Fri, 10 Mar 2017 05:08:53 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert client_context field to a 32 bit handle

The client_context field is passed around which is really just a pointer
to a msg_context.  A lookup table mechanism for msg_context was added
previously, so convert this field to a handle as well.

The firmware never interperates the client_context, just passed it back.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert delayed_buffer to u32
Michael Zoran [Fri, 10 Mar 2017 05:08:52 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert delayed_buffer to u32

A delayed buffer field is passed between the firmware and the
kernel.  This field is never used either so it's safe to
change it to a u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Convert client_component field to u32
Michael Zoran [Fri, 10 Mar 2017 05:08:51 +0000 (21:08 -0800)]
staging: bcm2835-camera: Convert client_component field to u32

In the messages passed back and forth between the camera and
the firmware, a client_component field is passed.

This is a pointer to a structure that represents part of the
camera. Luckly, it's only used for debug logging, so simply
convert it to a u32.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: bcm2835-camera: Create struct mmal_es_format_local to mirror struct mmal_es_...
Michael Zoran [Fri, 10 Mar 2017 05:08:50 +0000 (21:08 -0800)]
staging: bcm2835-camera: Create struct mmal_es_format_local to mirror struct mmal_es_format

The struct struct mmal_es_format is passed between the firmware which has
pointers.  A local version of mmal_es_format is also used.

Luckly, the two versions are always memberwise copied from each other
so simply have different structures for the local and msg versions.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: firmware: Convert sscanf calls to strtoul
Michael Sartain [Thu, 9 Mar 2017 16:58:06 +0000 (09:58 -0700)]
staging: greybus: firmware: Convert sscanf calls to strtoul

Also convert the fw_update_type and fw_timeout variables to
unsigned and update the printf specifier to %u.

The FW_MGMT_IOC_SET_TIMEOUT_MS ioctl takes an unsigned int
and checkpatch was complaining about not checking the sscanf
return values.

Signed-off-by: Michael Sartain <mikesart@fastmail.com>
Acked-by: Viresh Kumar <viresh.kumar at linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: firmware: Change long long unsigned to unsigned long long
Michael Sartain [Thu, 9 Mar 2017 16:58:05 +0000 (09:58 -0700)]
staging: greybus: firmware: Change long long unsigned to unsigned long long

Fixes checkpatch warning:
  type 'long long unsigned int' should be specified
  in [[un]signed] [short|int|long|long long] order

Signed-off-by: Michael Sartain <mikesart@fastmail.com>
Acked-by: Viresh Kumar <viresh.kumar at linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: firmware: Remove extra braces from single line if
Michael Sartain [Thu, 9 Mar 2017 16:58:04 +0000 (09:58 -0700)]
staging: greybus: firmware: Remove extra braces from single line if

Fixes checkpatch warning:
  braces {} are not necessary for any arm of this statement

Signed-off-by: Michael Sartain <mikesart@fastmail.com>
Acked-by: Viresh Kumar <viresh.kumar at linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: firmware: Remove trailing semicolon from FW_TIMEOUT_DEFAULT
Michael Sartain [Thu, 9 Mar 2017 16:58:03 +0000 (09:58 -0700)]
staging: greybus: firmware: Remove trailing semicolon from FW_TIMEOUT_DEFAULT

Fixes checkpatch warning:
  macros should not use a trailing semicolon

Signed-off-by: Michael Sartain <mikesart@fastmail.com>
Acked-by: Viresh Kumar <viresh.kumar at linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Refactor conditionals
Narcisa Ana Maria Vasile [Sat, 4 Mar 2017 20:02:42 +0000 (22:02 +0200)]
staging: vc04_services: Refactor conditionals

Refactor conditionals to reduce one level of indentation and improve
code readability.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: Remove error message on kmalloc() failure
Narcisa Ana Maria Vasile [Sat, 4 Mar 2017 20:02:31 +0000 (22:02 +0200)]
staging: vc04_services: Remove error message on kmalloc() failure

Remove 'Out of memory' message because kmalloc already prints a message
in case of error.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: removed code in comments.
Arushi Singhal [Thu, 9 Mar 2017 16:13:46 +0000 (21:43 +0530)]
staging: ks7010: removed code in comments.

Commenting Code Is a Bad Idea.
Comments are their to explain the code and how the code achieves its
goal and as codes in the comments  does not explain what the code is
doing so there is no use of commenting them.
So in this patch codes in the comments are removed.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: Remove useless cast.
Varsha Rao [Thu, 9 Mar 2017 14:19:01 +0000 (19:49 +0530)]
staging: comedi: Remove useless cast.

Variable dac_data is already declared as of type u8. Again explicit type
casting of dac_data to u8, is not required. Hence this patch removes it
by using the following coccinelle script.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>