drivers/phy/freescale/phy-fsl-imx8mq-usb.c:133 tca_blk_typec_switch_set() error: 'imx_phy' dereferencing possible ERR_PTR()

kernel test robot <[email protected]> Fri, 24 Jul 2026 06:22:58 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Franz Schnyder <[email protected]>
CC: Vinod Koul <[email protected]>
CC: Frank Li <[email protected]>
CC: Xu Yang <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4539944e515183668109bdf4d0c3d7d228383d88
commit: 49ccab4bedd4779899246107dc19fb01c5b6fea3 phy: fsl-imx8mq-usb: fix typec orientation switch when built as module
date:   7 months ago
:::::: branch date: 27 hours ago
:::::: commit date: 7 months ago
config: powerpc-randconfig-r072-20260723 (https://download.01.org/0day-ci/archive/20260724/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: 49ccab4bedd4 ("phy: fsl-imx8mq-usb: fix typec orientation switch when built as module")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/phy/freescale/phy-fsl-imx8mq-usb.c:133 tca_blk_typec_switch_set() error: 'imx_phy' dereferencing possible ERR_PTR()

vim +/imx_phy +133 drivers/phy/freescale/phy-fsl-imx8mq-usb.c

efe81bea8915866 Li Jun  2018-11-15  124  
b58f0f86fd6156d Xu Yang 2024-12-04  125  
b58f0f86fd6156d Xu Yang 2024-12-04  126  static void tca_blk_orientation_set(struct tca_blk *tca,
b58f0f86fd6156d Xu Yang 2024-12-04  127  				enum typec_orientation orientation);
b58f0f86fd6156d Xu Yang 2024-12-04  128  
b58f0f86fd6156d Xu Yang 2024-12-04  129  static int tca_blk_typec_switch_set(struct typec_switch_dev *sw,
b58f0f86fd6156d Xu Yang 2024-12-04  130  				enum typec_orientation orientation)
b58f0f86fd6156d Xu Yang 2024-12-04  131  {
b58f0f86fd6156d Xu Yang 2024-12-04  132  	struct imx8mq_usb_phy *imx_phy = typec_switch_get_drvdata(sw);
b58f0f86fd6156d Xu Yang 2024-12-04 @133  	struct tca_blk *tca = imx_phy->tca;
b58f0f86fd6156d Xu Yang 2024-12-04  134  	int ret;
b58f0f86fd6156d Xu Yang 2024-12-04  135  
b58f0f86fd6156d Xu Yang 2024-12-04  136  	if (tca->orientation == orientation)
b58f0f86fd6156d Xu Yang 2024-12-04  137  		return 0;
b58f0f86fd6156d Xu Yang 2024-12-04  138  
b58f0f86fd6156d Xu Yang 2024-12-04  139  	ret = clk_prepare_enable(imx_phy->clk);
b58f0f86fd6156d Xu Yang 2024-12-04  140  	if (ret)
b58f0f86fd6156d Xu Yang 2024-12-04  141  		return ret;
b58f0f86fd6156d Xu Yang 2024-12-04  142  
b58f0f86fd6156d Xu Yang 2024-12-04  143  	tca_blk_orientation_set(tca, orientation);
b58f0f86fd6156d Xu Yang 2024-12-04  144  	clk_disable_unprepare(imx_phy->clk);
b58f0f86fd6156d Xu Yang 2024-12-04  145  
b58f0f86fd6156d Xu Yang 2024-12-04  146  	return 0;
b58f0f86fd6156d Xu Yang 2024-12-04  147  }
b58f0f86fd6156d Xu Yang 2024-12-04  148  

:::::: The code at line 133 was first introduced by commit
:::::: b58f0f86fd6156d7b084257f5c91ceaf7d760927 phy: fsl-imx8mq-usb: add tca function driver for imx95

:::::: TO: Xu Yang <[email protected]>
:::::: CC: Vinod Koul <[email protected]>

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