diff options
author | Luis Henriques <luis.henriques@canonical.com> | 2013-08-14 18:10:06 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-08-15 12:17:05 -0400 |
commit | dee08ab83d0378d922b67e7cf10bbec3e4ea343b (patch) | |
tree | 4f5786e70c1c89f63d2269ad19c94725ce03f896 /net/rfkill | |
parent | d8eb741eb374804e864751c7f3919ae50321d831 (diff) |
net: rfkill: Do not ignore errors from regulator_enable()
Function regulator_enable() may return an error that has to be checked.
This patch changes function rfkill_regulator_set_block() so that it checks
for the return code. Also, rfkill_data->reg_enabled is set to 'true' only
if there is no error.
This fixes the following compilation warning:
net/rfkill/rfkill-regulator.c:43:20: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r-- | net/rfkill/rfkill-regulator.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c index d11ac79246e4..cf5b145902e5 100644 --- a/net/rfkill/rfkill-regulator.c +++ b/net/rfkill/rfkill-regulator.c | |||
@@ -30,6 +30,7 @@ struct rfkill_regulator_data { | |||
30 | static int rfkill_regulator_set_block(void *data, bool blocked) | 30 | static int rfkill_regulator_set_block(void *data, bool blocked) |
31 | { | 31 | { |
32 | struct rfkill_regulator_data *rfkill_data = data; | 32 | struct rfkill_regulator_data *rfkill_data = data; |
33 | int ret = 0; | ||
33 | 34 | ||
34 | pr_debug("%s: blocked: %d\n", __func__, blocked); | 35 | pr_debug("%s: blocked: %d\n", __func__, blocked); |
35 | 36 | ||
@@ -40,15 +41,16 @@ static int rfkill_regulator_set_block(void *data, bool blocked) | |||
40 | } | 41 | } |
41 | } else { | 42 | } else { |
42 | if (!rfkill_data->reg_enabled) { | 43 | if (!rfkill_data->reg_enabled) { |
43 | regulator_enable(rfkill_data->vcc); | 44 | ret = regulator_enable(rfkill_data->vcc); |
44 | rfkill_data->reg_enabled = true; | 45 | if (!ret) |
46 | rfkill_data->reg_enabled = true; | ||
45 | } | 47 | } |
46 | } | 48 | } |
47 | 49 | ||
48 | pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, | 50 | pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, |
49 | regulator_is_enabled(rfkill_data->vcc)); | 51 | regulator_is_enabled(rfkill_data->vcc)); |
50 | 52 | ||
51 | return 0; | 53 | return ret; |
52 | } | 54 | } |
53 | 55 | ||
54 | static struct rfkill_ops rfkill_regulator_ops = { | 56 | static struct rfkill_ops rfkill_regulator_ops = { |