On 6/12/2024 4:15 PM, Johannes Berg wrote: >> >> use pr_err() instead of WARN() >> for this error case handling. > > I don't see anything wrong with the WARN here, it's the user/driver > calling it completely incorrectly. > the function is a kernel API and it is handing invalid user input. below comments for WARN() seems say that pr_err() is better than WARN() for this case. include/asm-generic/bug.h: /* * WARN(), WARN_ON(), WARN_ON_ONCE(), and so on can be used to report * significant kernel issues that need prompt attention if they should ever * appear at runtime. * * Do not use these macros when checking for invalid external inputs * (e.g. invalid system call arguments, or invalid data coming from * network/devices), and on transient conditions like ENOMEM or EAGAIN. * These macros should be used for recoverable kernel issues only. * For invalid external inputs, transient conditions, etc use * pr_err[_once/_ratelimited]() followed by dump_stack(), if necessary. * Do not include "BUG"/"WARNING" in format strings manually to make these * conditions distinguishable from kernel issues. * * Use the versions with printk format strings to provide better diagnostics. */ > I also don't really think this is a *fix*, if you used the API > incorrectly you can't necessarily expect a correct return value, I > guess, but anyway it shouldn't happen in the first place. > okay, will remove term fix and fix tag. the API returns type bool for block state, the type bool can't cover case for invalid user input. > I'm happy to take the return value change (only) as a cleanup, if you > wish to resend that. > i am pleasure to resend it after code review done. >> Fixed by > > Please also read > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches > okay, thank you > johannes