Test for NULL as !x instead of NULL comparisions for
functions that return NULL on failure.
Issue found using coccinelle
Semantic patch used to solve the problem is as follows
// <smpl>
@@
expression x;
statement S;
@@
x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|
usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));
-if(x==NULL)
+if(!x)
// </smpl>
Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kmalloc normally produces a backtrace when there is not enough memory.
So it is unnecessary to print an error message that provides only this
information. Hence, remove pr_error() from memory allocation check.
Issue found using Coccinelle.
Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Adjust code to fix the style issue – lines should not end with a
parenthesis.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
use help over --help-- for new help text
Signed-off-by: Anushka Shukla <anushkacharu9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add spaces around '+' operator to get rid of checkpatch warning.
Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The last two lines in the function could
be compressed into one. Avoid usage of local variable.
Issue found with Coccinelle using ret.cocci.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Adjust code to meet the style of “lines should not end with
parenthesis”.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Challenge suggested by coccinelle.
Remove unnecessary parathesis around the right hand of
assignment using the below script.
@@
binary operator op = {==,!=,&&,||,>=,<=,&,|};
expression l, r, t;
@@
(
l = (r op t)
|
l =
-(
r
-)
)
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace all NULL comparisons in the file to get rid of checkpatch
warnings
Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rtw_startbss_cmd can return the result of calling rtw_enqueue_cmd, which
can return the result of calling _rtw_enqueue_cmd, but they all have
different return types (u8, u32, and sint, respectively).
As all of these functions return error codes, change all the return types
to int, in preparation for converting these functions to use standard
kernel error codes.
Also, remove extern from the function declaration to maintain Linux kernel
coding style.
Issue suggested by Coccinelle.
Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Local variables pfhdr and prframe always have a same value,
so one of them is unnecessary.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add space between two words for better readability in the
comments.
Signed-off-by: Branden Bonaby <brandonbonaby94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Correct malformed SPDX-License-Identifier so that it
matches Linux kernel comment coding style.
Signed-off-by: Branden Bonaby <brandonbonaby94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This struct does not exist, and when it is looked up in the
compatibility tree, it returns null. Remove these nonfunctional lines.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The last two lines in the function could
be compressed into one. Avoid usage of local variable.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove comments which are not necessary.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The sequence
skb_put(skb);
skb_pull(skb);
leads to the same result as
skb_reserve(skb);
but second is a little shorter and clearer.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove braces around single statement block.
Issue found by checkpatch.pl
WARNING: braces {} are not necessary for a single statement block
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
All defined WFD* in wifi.h are unused in the driver code,
so remove them.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Correct SPDX-License-Identifier comment characters to silence
checkpatch.pl warning:
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `insn_read` handler for the EEPROM subdevice on M-series boards
(`ni_m_series_eeprom_insn_read()`) currently ignores `insn->n` (the
number of samples to read) and assumes a single sample is to be read
into `data[0]`. Fortunately, the Comedi core ensures that `data[]` has
a length of at least 16 so there is no problem with array bounds.
The usual Comedi convention for `insn_read` handlers is to read the same
channel `insn->n` times into successive elements of `data[]` so let's do
that. (Each channel corresponds to a single EEPROM address.) In this
case, the data value comes from a local copy of the EEPROM contents.
Also, follow the usual Comedi convention and return `insn->n` from the
handler to indicate success (although any non-negative value will do).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `insn_read` handler for the EEPROM subdevice on E-series boards
(`ni_eeprom_insn_read()`) currently ignores `insn->n` (the number of
samples to read) and assumes a single sample is to be read into
`data[0]`. Fortunately, the Comedi core ensures that `data[]` has a
length of at least 16 so there is no problem with array bounds.
The usual Comedi convention for `insn_read` handlers is to read the same
channel `insn->n` times into successive elements of `data[]` so let's do
that. (Each channel number corresponds to a single EEPROM address.)
Since we do not expect the EEPROM data at a particular address to change
between readings, let's just read it once and copy the value `insn->n`
times.
Also, follow the usual Comedi convention and return `insn->n` from the
handler to indicate success (although any non-negative value will do).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `insn_read` handler for the calibration subdevice
(`ni_calib_insn_read()`) currently ignores `insn->n` (the number of
samples to read) and assumes a single sample is to be read into
`data[0]`. Fortunately, the Comedi core ensures that `data[]` has a
length of at least 16, so there is no problem with array bounds.
The usual Comedi convention for `insn_read` handlers is to read the same
channel `insn->n` times into successive elements of `data[]`, so let's
do that.
Also, follow the usual Comedi convention and return `insn->n` from the
handler to indicate success (although any non-negative value will do).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `insn_write` handler for the calibration subdevice
(`ni_calib_insn_write()`) currently ignores `insn->n` (the number of
samples to write) and assumes a single sample is to be written, but
`insn->n` could be 0, meaning no samples should be written, in which
case `data[0]` is invalid.
Change `ni_calib_insn_write()` to only write to the calibration device
if `insn->n > 0`. There isn't much point writing all the values when
`insn->n > 1`, so just write the last one (`data[insn->n - 1]`).
Also follow the usual Comedi convention and return `insn->n` from the
handler to indicate success (although any non-negative return value will
do as far as the Comedi core is concerned).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A failure while processing the start command could cause dma_unmap_sg()
to be called without first calling dma_map_sg().
Since calling dma_unmap_sg() is only needed when data != NULL, move the
unmap call into the corresponding if {} block.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Obvious typo. It is specified as BURST in the datasheet.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There is no need to delay notifying the mmc layer. Schedule the delayed
work to run immediately.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This is set once during initialization and never changed. Don't bother
setting it again in the interrupt handler.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When waiting on completions, use the _io variant so the caller is
charged as using I/O.
This should have no effect on the module's functionality, only improve
CPU accounting.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver previously grabbed the SD pins for itself, ignoring the pin
controller. Remove this, and allow the pinctrl subsystem to set up the
pins using the device tree mappings. This allows this driver to work on
related devices that have a different pin controller mapping, such as
the MT7688. The hardcoded bit index was incorrect on that device.
The driver now needs a pin controller reference in its device tree node:
sdhci: /* ... */ {
compatible = "ralink,mt7620-sdhci";
pinctrl-names = "default";
pinctrl-0 = <&sdhci_pins>;
// ...
};
This change could break SD controller functionality on existing devices
whose device trees do not specify a pin controller and state for the SD
node.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove return variable and return return value directly. Issue found by
Coccinelle using ret.cocci.
Signed-off-by: Nishka Dasgupta <nishka.dasgupta@yahoo.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace '--help--' in Kconfig and indent the subsequent text to silence
checkpatch.pl
warning:
WARNING: prefer 'help' over '---help---' for new help texts
Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace '--help--' in Kconfig and indent the subsequent text to silence
checkpatch.pl
warning:
WARNING: prefer 'help' over '---help---' for new help texts
Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace '--help--' in Kconfig and indent the subsequent text to silence
checkpatch.pl
warning:
WARNING: prefer 'help' over '---help---' for new help texts
Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Edit CamelCase function name
Issue found by checkpatch.pl
Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the spacce around else.
Issue found by checkpatch.pl
ERROR: spaces required before that open brace '{'
ERROR: spaces required before that close brace '}'
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace NULL comparisons in the file.
Issue found by checkpatch.pl
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add spaces around the operators.
Issue found by checkpatch.pl
CHECK: spaces preferred around that '+'
CHECK: spaces preferred around that '*'
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ajdust alignment to match open paranthesis.
Issue found by checkpatch.pl
CHECK: Alignment should match open paranthesis.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove return variable and return the return value directly. Issue
suggested by ret.cocci.
Signed-off-by: Nishka Dasgupta <nishka.dasgupta@yahoo.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Convert a ternary statement into a if statement which is detected while
resolving "WARNING: line over 80 characters". Use BIT() macro instead
manually left shifting.
Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>