]> git.ipfire.org Git - thirdparty/linux.git/commit
interconnect: debugfs: Fix incorrect error handling for NULL path
authorKuan-Wei Chiu <visitorckw@gmail.com>
Fri, 10 Oct 2025 15:14:47 +0000 (23:14 +0800)
committerGeorgi Djakov <djakov@kernel.org>
Fri, 31 Oct 2025 00:53:58 +0000 (02:53 +0200)
commit6bfe104fd0f94d0248af22c256ce725ee087157b
tree9cd4a8cbce77447b1c802d38fd4f4c1ecef10664
parent245f14f5fe283c782b16143280f283bee29dbb5f
interconnect: debugfs: Fix incorrect error handling for NULL path

The icc_commit_set() function, used by the debugfs interface, checks
the validity of the global cur_path pointer using IS_ERR_OR_NULL().
However, in the specific case where cur_path is NULL, while
IS_ERR_OR_NULL(NULL) correctly evaluates to true, the subsequent call
to PTR_ERR(NULL) returns 0.

This causes the function to return a success code (0) instead of an
error, misleading the user into believing their bandwidth request was
successfully committed when, in fact, no operation was performed.

Fix this by adding an explicit check to return -EINVAL if cur_path is
NULL. This prevents silent failures and ensures that an invalid
operational sequence is immediately and clearly reported as an error.

Fixes: 770c69f037c1 ("interconnect: Add debugfs test client")
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Link: https://lore.kernel.org/r/20251010151447.2289779-1-visitorckw@gmail.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
drivers/interconnect/debugfs-client.c