diff options
author | Paul Bolle <pebolle@tiscali.nl> | 2014-09-17 19:02:51 (GMT) |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-18 16:46:42 (GMT) |
commit | 95369a73a957ad221f1d6b8f11a63a376f38c544 (patch) | |
tree | 750f0e5fc1c62234095680e313502a59a3af1207 /include/rdma/iw_portmap.h | |
parent | a3d3c53f738bb931e15b20d3dc5d23722b9ede6a (diff) | |
download | linux-95369a73a957ad221f1d6b8f11a63a376f38c544.tar.xz |
eeepc-laptop: simplify parse_arg()
parse_arg() has three possible return values:
-EINVAL if sscanf(), in short, fails;
zero if "count" is zero; and
"count" in all other cases
But "count" will never be zero. See, parse_arg() is called by the
various store functions. And the callchain of these functions starts
with sysfs_kf_write(). And that function checks for a zero "count". So
we can stop checking for a zero "count", drop the "count" argument
entirely, and transform parse_arg() into a function that returns zero on
success or a negative error. That, in turn, allows to make those store
functions just return "count" on success. The net effect is that the
code becomes a bit easier to understand.
A nice side effect is that this GCC warning is silenced too:
drivers/platform/x86/eeepc-laptop.c: In function ‘store_sys_acpi’:
drivers/platform/x86/eeepc-laptop.c:279:10: warning: ‘value’ may be used uninitialized in this function [-Wmaybe-uninitialized]
int rv, value;
Which is, of course, the reason to have a look at parse_arg().
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'include/rdma/iw_portmap.h')
0 files changed, 0 insertions, 0 deletions