diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-02-09 19:42:36 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-16 21:32:34 +0100 |
commit | 37ace20a3c99c54ebffb4b13671a01adb20926ca (patch) | |
tree | 61cebd374f01c3957f462ce8f5819d15849734e3 /drivers/thermal/x86_pkg_temp_thermal.c | |
parent | Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher... (diff) | |
download | linux-37ace20a3c99c54ebffb4b13671a01adb20926ca.tar.xz linux-37ace20a3c99c54ebffb4b13671a01adb20926ca.zip |
dmascc: Return correct error codes
This change has been made with the goal that kernel functions should
return something more descriptive than -1 on failure.
A variable `err` has been introduced for storing error codes.
The return value of kzalloc on failure should return a -1 and not a
-ENOMEM. This was found using Coccinelle. A simplified version of
the semantic patch used is:
//<smpl>
@@
expression *e;
identifier l1;
@@
e = kzalloc(...);
if (e == NULL) {
...
goto l1;
}
l1:
...
return -1
+ -ENOMEM
;
//</smpl
Furthermore, set `err` to -ENOMEM on failure of alloc_netdev(), and to
-ENODEV on failure of register_netdev() and probe_irq_off().
The single call site only checks that the return value is not 0,
hence no change is required at the call site.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/thermal/x86_pkg_temp_thermal.c')
0 files changed, 0 insertions, 0 deletions