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>
This commit is contained in:
Zijun Hu 2024-06-13 22:04:36 +08:00 committed by Johannes Berg
parent 021d53a3d8
commit 1bbdb7f7a4

View File

@ -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),
if (WARN(reason & ~(RFKILL_HARD_BLOCK_SIGNAL |
RFKILL_HARD_BLOCK_NOT_OWNER),
"hw_state reason not supported: 0x%lx", reason))
return blocked;
return rfkill_blocked(rfkill);
spin_lock_irqsave(&rfkill->lock, flags);
prev = !!(rfkill->hard_block_reasons & reason);