Re: [PATCH v5 2/7] mux: Add helper functions for getting optional and selected mux-state

From: kernel test robot

Date: Sun Jan 18 2026 - 08:29:01 EST


Hi Josua,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 8f0b4cce4481fb22653697cced8d0d04027cb1e8]

url: https://github.com/intel-lab-lkp/linux/commits/Josua-Mayer/phy-can-transceiver-rename-temporary-helper-function-to-avoid-conflict/20260118-183905
base: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
patch link: https://lore.kernel.org/r/20260118-rz-sdio-mux-v5-2-3c37e8872683%40solid-run.com
patch subject: [PATCH v5 2/7] mux: Add helper functions for getting optional and selected mux-state
config: um-randconfig-r071-20260118 (https://download.01.org/0day-ci/archive/20260118/202601182117.l2nFZ5OB-lkp@xxxxxxxxx/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
smatch version: v0.5.0-8985-g2614ff1a
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260118/202601182117.l2nFZ5OB-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601182117.l2nFZ5OB-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/mux/core.c:774:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
774 | if (IS_ERR_OR_NULL(mstate))
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/mux/core.c:793:17: note: uninitialized use occurs here
793 | return ERR_PTR(ret);
| ^~~
drivers/mux/core.c:774:2: note: remove the 'if' if its condition is always false
774 | if (IS_ERR_OR_NULL(mstate))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
775 | goto err_mux_state_get;
| ~~~~~~~~~~~~~~~~~~~~~~
drivers/mux/core.c:767:9: note: initialize the variable 'ret' to silence this warning
767 | int ret;
| ^
| = 0
1 warning generated.


vim +774 drivers/mux/core.c

748
749 /**
750 * __devm_mux_state_get() - Get the optional mux-state for a device,
751 * with resource management.
752 * @dev: The device that needs a mux-state.
753 * @mux_name: The name identifying the mux-state.
754 * @optional: Whether to return NULL and silence errors when mux doesn't exist.
755 * @init: Optional function pointer for mux-state object initialisation.
756 * @exit: Optional function pointer for mux-state object cleanup on release.
757 *
758 * Return: Pointer to the mux-state, or an ERR_PTR with a negative errno.
759 */
760 static struct mux_state *__devm_mux_state_get(struct device *dev, const char *mux_name,
761 bool optional,
762 int (*init)(struct mux_state *mstate),
763 int (*exit)(struct mux_state *mstate))
764 {
765 struct devm_mux_state_state *devm_state;
766 struct mux_state *mstate;
767 int ret;
768
769 devm_state = devres_alloc(devm_mux_state_release, sizeof(*devm_state), GFP_KERNEL);
770 if (!devm_state)
771 return ERR_PTR(-ENOMEM);
772
773 mstate = mux_state_get(dev, mux_name, optional);
> 774 if (IS_ERR_OR_NULL(mstate))
775 goto err_mux_state_get;
776
777 if (init) {
778 ret = init(mstate);
779 if (ret)
780 goto err_mux_state_init;
781 }
782
783 devm_state->mstate = mstate;
784 devm_state->exit = exit;
785 devres_add(dev, devm_state);
786
787 return mstate;
788
789 err_mux_state_init:
790 mux_state_put(mstate);
791 err_mux_state_get:
792 devres_free(devm_state);
793 return ERR_PTR(ret);
794 }
795

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki