Skip to content

Commit dee08ab

Browse files
Luis Henriquesjmberg-intel
authored andcommitted
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>
1 parent d8eb741 commit dee08ab

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎net/rfkill/rfkill-regulator.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct rfkill_regulator_data {
3030
static int rfkill_regulator_set_block(void *data, bool blocked)
3131
{
3232
struct rfkill_regulator_data *rfkill_data = data;
33+
int ret = 0;
3334

3435
pr_debug("%s: blocked: %d\n", __func__, blocked);
3536

@@ -40,15 +41,16 @@ static int rfkill_regulator_set_block(void *data, bool blocked)
4041
}
4142
} else {
4243
if (!rfkill_data->reg_enabled) {
43-
regulator_enable(rfkill_data->vcc);
44-
rfkill_data->reg_enabled = true;
44+
ret = regulator_enable(rfkill_data->vcc);
45+
if (!ret)
46+
rfkill_data->reg_enabled = true;
4547
}
4648
}
4749

4850
pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__,
4951
regulator_is_enabled(rfkill_data->vcc));
5052

51-
return 0;
53+
return ret;
5254
}
5355

5456
static struct rfkill_ops rfkill_regulator_ops = {

0 commit comments

Comments
 (0)