[bug report] mux: Add helper functions for getting optional and selected mux-state

Dan Carpenter <[email protected]>
Newsgroups org.kernel.vger.kernel-janitors
Message-ID <[email protected]>
Hello Josua Mayer,

Commit 993bcaf32c49 ("mux: Add helper functions for getting optional
and selected mux-state") from Feb 26, 2026 (linux-next), leads to the
following Smatch static checker warning:

	drivers/mux/core.c:640 mux_control_get()
	warn: 'mux' is an error pointer or valid

drivers/mux/core.c
    630  * mux_control_get() - Get the mux-control for a device.
    631  * @dev: The device that needs a mux-control.
    632  * @mux_name: The name identifying the mux-control.
    633  *
    634  * Return: A pointer to the mux-control, or an ERR_PTR with a negative errno.
    635  */
    636 struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
    637 {
    638         struct mux_control *mux = mux_get(dev, mux_name, NULL, false);

mux_get() can only return NULL if optional is true.

    639 
--> 640         if (!mux)

this should be if (IS_ERR(mux)) {

    641                 return ERR_PTR(-ENOENT);
    642 
    643         return mux;
    644 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.