From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Divya Koppera <divya.koppera@microchip.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: drivers/net/phy/microchip_t1.c:1299 lan887x_phy_init() warn: 'priv->clock' can also be NULL
Date: Tue, 16 Dec 2025 16:27:46 +0300 [thread overview]
Message-ID: <202512160211.FZ4wuVcH-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: 8541fc12edcdef36a02885672f22ca8391bd2443 net: phy: microchip_t1: Enable pin out specific to lan887x phy for PEROUT signal
config: sparc-randconfig-r072-20251213 (https://download.01.org/0day-ci/archive/20251216/202512160211.FZ4wuVcH-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 15.1.0
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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512160211.FZ4wuVcH-lkp@intel.com/
smatch warnings:
drivers/net/phy/microchip_t1.c:1299 lan887x_phy_init() warn: 'priv->clock' can also be NULL
vim +1299 drivers/net/phy/microchip_t1.c
0941c832823498 Divya Koppera 2024-08-21 1280 static int lan887x_phy_init(struct phy_device *phydev)
0941c832823498 Divya Koppera 2024-08-21 1281 {
9fc3d6fe802923 Divya Koppera 2024-12-19 1282 struct lan887x_priv *priv = phydev->priv;
0941c832823498 Divya Koppera 2024-08-21 1283 int ret;
0941c832823498 Divya Koppera 2024-08-21 1284
9fc3d6fe802923 Divya Koppera 2024-12-19 1285 if (!priv->init_done && phy_interrupt_is_valid(phydev)) {
9fc3d6fe802923 Divya Koppera 2024-12-19 1286 priv->clock = mchp_rds_ptp_probe(phydev, MDIO_MMD_VEND1,
9fc3d6fe802923 Divya Koppera 2024-12-19 1287 MCHP_RDS_PTP_LTC_BASE_ADDR,
9fc3d6fe802923 Divya Koppera 2024-12-19 1288 MCHP_RDS_PTP_PORT_BASE_ADDR);
9fc3d6fe802923 Divya Koppera 2024-12-19 1289 if (IS_ERR(priv->clock))
9fc3d6fe802923 Divya Koppera 2024-12-19 1290 return PTR_ERR(priv->clock);
The KConfig does this:
select MICROCHIP_PHY_RDS_PTP if NETWORK_PHY_TIMESTAMPING
Since this config doesn't have NETWORK_PHY_TIMESTAMPING then
priv->clock is NULL
9fc3d6fe802923 Divya Koppera 2024-12-19 1291
8541fc12edcdef Divya Koppera 2025-01-15 1292 /* Enable pin mux for EVT */
8541fc12edcdef Divya Koppera 2025-01-15 1293 phy_modify_mmd(phydev, MDIO_MMD_VEND1,
8541fc12edcdef Divya Koppera 2025-01-15 1294 LAN887X_MX_CHIP_TOP_REG_CONTROL1,
8541fc12edcdef Divya Koppera 2025-01-15 1295 LAN887X_MX_CHIP_TOP_REG_CONTROL1_EVT_EN,
8541fc12edcdef Divya Koppera 2025-01-15 1296 LAN887X_MX_CHIP_TOP_REG_CONTROL1_EVT_EN);
8541fc12edcdef Divya Koppera 2025-01-15 1297
8541fc12edcdef Divya Koppera 2025-01-15 1298 /* Initialize pin numbers specific to PEROUT */
8541fc12edcdef Divya Koppera 2025-01-15 @1299 priv->clock->event_pin = 3;
^^^^^^^^^^^
Potentially resulting in a NULL dereference.
8541fc12edcdef Divya Koppera 2025-01-15 1300
9fc3d6fe802923 Divya Koppera 2024-12-19 1301 priv->init_done = true;
9fc3d6fe802923 Divya Koppera 2024-12-19 1302 }
9fc3d6fe802923 Divya Koppera 2024-12-19 1303
0941c832823498 Divya Koppera 2024-08-21 1304 /* Clear loopback */
0941c832823498 Divya Koppera 2024-08-21 1305 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1,
0941c832823498 Divya Koppera 2024-08-21 1306 LAN887X_MIS_CFG_REG2,
0941c832823498 Divya Koppera 2024-08-21 1307 LAN887X_MIS_CFG_REG2_FE_LPBK_EN);
0941c832823498 Divya Koppera 2024-08-21 1308 if (ret < 0)
0941c832823498 Divya Koppera 2024-08-21 1309 return ret;
0941c832823498 Divya Koppera 2024-08-21 1310
0941c832823498 Divya Koppera 2024-08-21 1311 /* Configure default behavior of led to link and activity for any
0941c832823498 Divya Koppera 2024-08-21 1312 * speed
0941c832823498 Divya Koppera 2024-08-21 1313 */
0941c832823498 Divya Koppera 2024-08-21 1314 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1,
0941c832823498 Divya Koppera 2024-08-21 1315 LAN887X_COMMON_LED3_LED2,
0941c832823498 Divya Koppera 2024-08-21 1316 LAN887X_COMMON_LED2_MODE_SEL_MASK,
0941c832823498 Divya Koppera 2024-08-21 1317 LAN887X_LED_LINK_ACT_ANY_SPEED);
0941c832823498 Divya Koppera 2024-08-21 1318 if (ret < 0)
0941c832823498 Divya Koppera 2024-08-21 1319 return ret;
0941c832823498 Divya Koppera 2024-08-21 1320
0941c832823498 Divya Koppera 2024-08-21 1321 /* PHY interface setup */
0941c832823498 Divya Koppera 2024-08-21 1322 return lan887x_config_phy_interface(phydev);
0941c832823498 Divya Koppera 2024-08-21 1323 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-12-16 13:27 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=202512160211.FZ4wuVcH-lkp@intel.com \
--to=dan.carpenter@linaro.org \
--cc=divya.koppera@microchip.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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