[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aIv66YIxgX+ufdaP@lizhi-Precision-Tower-5810>
Date: Thu, 31 Jul 2025 19:23:21 -0400
From: Frank Li <Frank.li@....com>
To: quanyang.wang@...driver.com
Cc: Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Richard Zhu <hongxing.zhu@....com>, linux-phy@...ts.infradead.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] phy: freescale: imx8qm-hsio: Fix a use of uninitialized
mutex
On Thu, Jul 31, 2025 at 10:07:17AM +0800, quanyang.wang@...driver.com wrote:
> From: Quanyang Wang <quanyang.wang@...driver.com>
>
> Using an uninitialized mutex leads to the following warning when
> CONFIG_DEBUG_MUTEXES is enabled.
>
> DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> WARNING: CPU: 2 PID: 49 at kernel/locking/mutex.c:577 __mutex_lock+0x690/0x820
> Modules linked in:
> CPU: 2 UID: 0 PID: 49 Comm: kworker/u16:2 Not tainted 6.16.0-04405-g4b290aae788e #23 PREEMPT
> Hardware name: Freescale i.MX8QM MEK (DT)
> Workqueue: events_unbound deferred_probe_work_func
> pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : __mutex_lock+0x690/0x820
> lr : __mutex_lock+0x690/0x820
> sp : ffff8000830b3900
> x29: ffff8000830b3960 x28: ffff80008223bac0 x27: 0000000000000000
> x26: ffff000802fc4680 x25: ffff000800019a0d x24: 0000000000000000
> x23: ffff8000806f0d6c x22: 0000000000000002 x21: 0000000000000000
> x20: ffff8000830b3930 x19: ffff000802338090 x18: fffffffffffe6138
> x17: 67657220796d6d75 x16: 6420676e69737520 x15: 0000000000000038
> x14: 0000000000000000 x13: ffff8000822636f0 x12: 000000000000044a
> x11: 000000000000016e x10: ffff8000822bd940 x9 : ffff8000822636f0
> x8 : 00000000ffffefff x7 : ffff8000822bb6f0 x6 : 000000000000016e
> x5 : 000000000000016f x4 : 40000000fffff16e x3 : 0000000000000000
> x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008003b8000
> Call trace:
> __mutex_lock+0x690/0x820 (P)
> mutex_lock_nested+0x24/0x30
> imx_hsio_power_on+0x4c/0x764
> phy_power_on+0x7c/0x12c
> imx_sata_enable+0x1ec/0x488
> imx_ahci_probe+0x1a4/0x560
> platform_probe+0x5c/0x98
> really_probe+0xac/0x298
> __driver_probe_device+0x78/0x12c
> driver_probe_device+0xd8/0x160
> __device_attach_driver+0xb8/0x138
> bus_for_each_drv+0x88/0xe8
> __device_attach+0xa0/0x190
> device_initial_probe+0x14/0x20
> bus_probe_device+0xac/0xb0
> deferred_probe_work_func+0x8c/0xc8
> process_one_work+0x1e4/0x440
> worker_thread+0x1b4/0x350
> kthread+0x138/0x214
> ret_from_fork+0x10/0x20
>
> Fixes: 82c56b6dd24f ("phy: freescale: imx8qm-hsio: Add i.MX8QM HSIO PHY driver support")
> Signed-off-by: Quanyang Wang <quanyang.wang@...driver.com>
> ---
> drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> index 5dca93cd325c8..c97b7ae3f5b63 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> @@ -590,6 +590,8 @@ static int imx_hsio_probe(struct platform_device *pdev)
> phy_set_drvdata(phy, lane);
> }
>
> + mutex_init(&priv->lock);
> +
use devm_mutex_init();
Frank
> dev_set_drvdata(dev, priv);
> dev_set_drvdata(&pdev->dev, priv);
>
> --
> 2.43.0
>
Powered by blists - more mailing lists