summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZijun Hu <quic_zijuhu@quicinc.com>2024-06-13 17:04:36 +0300
committerJohannes Berg <johannes.berg@intel.com>2024-06-26 11:49:01 +0300
commit1bbdb7f7a4ebf2596b06a6bb84505a4a37a66d2e (patch)
tree1887d3ae5ce1d282ad3046dd7fcec85b7915193b /net
parent021d53a3d87eeb9dbba524ac515651242a2a7e3b (diff)
downloadlinux-1bbdb7f7a4ebf2596b06a6bb84505a4a37a66d2e.tar.xz
net: rfkill: Correct return value in invalid parameter case
rfkill_set_hw_state_reason() does not return current combined block state when its parameter @reason is invalid, that is wrong according to its comments, fix it by correcting the value returned. Also reformat the WARN while at it. Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://patch.msgid.link/1718287476-28227-1-git-send-email-quic_zijuhu@quicinc.com [edit/reformat commit message, remove unneeded variable] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/rfkill/core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index c3feb4f49d09..7a5367628c05 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -546,10 +546,10 @@ bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
BUG_ON(!rfkill);
- if (WARN(reason &
- ~(RFKILL_HARD_BLOCK_SIGNAL | RFKILL_HARD_BLOCK_NOT_OWNER),
- "hw_state reason not supported: 0x%lx", reason))
- return blocked;
+ if (WARN(reason & ~(RFKILL_HARD_BLOCK_SIGNAL |
+ RFKILL_HARD_BLOCK_NOT_OWNER),
+ "hw_state reason not supported: 0x%lx", reason))
+ return rfkill_blocked(rfkill);
spin_lock_irqsave(&rfkill->lock, flags);
prev = !!(rfkill->hard_block_reasons & reason);