From: Josua Mayer <josua@solid-run.com>
To: Peter Rosin <peda@axentia.se>, Ulf Hansson <ulfh@kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Dan Carpenter <error27@gmail.com>,
linux-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Josua Mayer <josua@solid-run.com>
Subject: [PATCH] mux: drop superfluous null check
Date: Thu, 23 Apr 2026 17:36:08 +0200 [thread overview]
Message-ID: <20260423-mux-smatch-fixup-v1-1-9f403014e0d7@solid-run.com> (raw)
The internal helper function mux_get may return NULL for non-existent
muxes, only if the optional argument is true. Otherwise ERR_PTR is
returned.
The public mux_control_get function is not allowed to return NULL, and
must return a valid ERR_PTR for non-existent muxes.
Since mux_control_get uses mux_get with optional set false, there is no
need to check for the impossible outcome NULL.
Drop the unnecessary NULL check.
Fixes: 993bcaf32c49 ("mux: Add helper functions for getting optional and selected mux-state")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/adjNEl0C8OgEjMI7@stanley.mountain
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
drivers/mux/core.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/mux/core.c b/drivers/mux/core.c
index 23538de2c91b4..9f124f4db8af2 100644
--- a/drivers/mux/core.c
+++ b/drivers/mux/core.c
@@ -635,12 +635,7 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name,
*/
struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
{
- struct mux_control *mux = mux_get(dev, mux_name, NULL, false);
-
- if (!mux)
- return ERR_PTR(-ENOENT);
-
- return mux;
+ return mux_get(dev, mux_name, NULL, false);
}
EXPORT_SYMBOL_GPL(mux_control_get);
---
base-commit: 2e68039281932e6dc37718a1ea7cbb8e2cda42e6
change-id: 20260423-mux-smatch-fixup-be29cefca0b1
Best regards,
--
Josua Mayer <josua@solid-run.com>
reply other threads:[~2026-04-23 15:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260423-mux-smatch-fixup-v1-1-9f403014e0d7@solid-run.com \
--to=josua@solid-run.com \
--cc=error27@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=ulfh@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®