[PATCH] phy: freescale: Initialize priv->lock

Xiaolei Wang posted 1 patch 1 week, 1 day ago
drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] phy: freescale: Initialize priv->lock
Posted by Xiaolei Wang 1 week, 1 day ago
Initialize priv->lock to fix the following warning.

WARNING: CPU: 0 PID: 12 at kernel/locking/mutex.c:577 __mutex_lock+0x70c/0x8b8
 Modules linked in:
 Hardware name: Freescale i.MX8QM MEK (DT)
 Call trace:
  __mutex_lock+0x70c/0x8b8 (P)
  mutex_lock_nested+0x24/0x30
  imx_hsio_power_on+0x4c/0x764
  phy_power_on+0x7c/0x12c
  imx_pcie_host_init+0x1d0/0x4d4
  dw_pcie_host_init+0x188/0x4b0
  imx_pcie_probe+0x324/0x6f4
  platform_probe+0x5c/0x98
  really_probe+0xbc/0x29c
  __driver_probe_device+0x78/0x12c
  driver_probe_device+0xd8/0x160
  __device_attach_driver+0xb8/0x138
  bus_for_each_drv+0x84/0xe4
  __device_attach_async_helper+0xb8/0xdc
  async_run_entry_fn+0x34/0xe0
  process_one_work+0x220/0x694
  worker_thread+0x1c0/0x36c
  kthread+0x14c/0x224

Fixes: 82c56b6dd24f ("phy: freescale: imx8qm-hsio: Add i.MX8QM HSIO PHY driver support")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
index 5dca93cd325c..9453ab98e475 100644
--- a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
+++ b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
@@ -545,6 +545,7 @@ static int imx_hsio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	priv->dev = &pdev->dev;
 	priv->drvdata = of_device_get_match_data(dev);
+	mutex_init(&priv->lock);
 
 	/* Get HSIO configuration mode */
 	if (of_property_read_string(np, "fsl,hsio-cfg", &priv->hsio_cfg))
-- 
2.43.0
Re: [PATCH] phy: freescale: Initialize priv->lock
Posted by Frank Li 1 week, 1 day ago
On Tue, Sep 23, 2025 at 10:16:11PM +0800, Xiaolei Wang wrote:
> Initialize priv->lock to fix the following warning.
>
> WARNING: CPU: 0 PID: 12 at kernel/locking/mutex.c:577 __mutex_lock+0x70c/0x8b8
>  Modules linked in:
>  Hardware name: Freescale i.MX8QM MEK (DT)
>  Call trace:
>   __mutex_lock+0x70c/0x8b8 (P)
>   mutex_lock_nested+0x24/0x30
>   imx_hsio_power_on+0x4c/0x764
>   phy_power_on+0x7c/0x12c
>   imx_pcie_host_init+0x1d0/0x4d4
>   dw_pcie_host_init+0x188/0x4b0
>   imx_pcie_probe+0x324/0x6f4
>   platform_probe+0x5c/0x98
>   really_probe+0xbc/0x29c
>   __driver_probe_device+0x78/0x12c
>   driver_probe_device+0xd8/0x160
>   __device_attach_driver+0xb8/0x138
>   bus_for_each_drv+0x84/0xe4
>   __device_attach_async_helper+0xb8/0xdc
>   async_run_entry_fn+0x34/0xe0
>   process_one_work+0x220/0x694
>   worker_thread+0x1c0/0x36c
>   kthread+0x14c/0x224
>
> Fixes: 82c56b6dd24f ("phy: freescale: imx8qm-hsio: Add i.MX8QM HSIO PHY driver support")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>  drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> index 5dca93cd325c..9453ab98e475 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
> @@ -545,6 +545,7 @@ static int imx_hsio_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	priv->dev = &pdev->dev;
>  	priv->drvdata = of_device_get_match_data(dev);
> +	mutex_init(&priv->lock);

use devm_mutex_init()

Frank
>
>  	/* Get HSIO configuration mode */
>  	if (of_property_read_string(np, "fsl,hsio-cfg", &priv->hsio_cfg))
> --
> 2.43.0
>
Re: [PATCH] phy: freescale: Initialize priv->lock
Posted by xiaolei wang 1 week ago
On 9/24/25 03:27, Frank Li wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, Sep 23, 2025 at 10:16:11PM +0800, Xiaolei Wang wrote:
>> Initialize priv->lock to fix the following warning.
>>
>> WARNING: CPU: 0 PID: 12 at kernel/locking/mutex.c:577 __mutex_lock+0x70c/0x8b8
>>   Modules linked in:
>>   Hardware name: Freescale i.MX8QM MEK (DT)
>>   Call trace:
>>    __mutex_lock+0x70c/0x8b8 (P)
>>    mutex_lock_nested+0x24/0x30
>>    imx_hsio_power_on+0x4c/0x764
>>    phy_power_on+0x7c/0x12c
>>    imx_pcie_host_init+0x1d0/0x4d4
>>    dw_pcie_host_init+0x188/0x4b0
>>    imx_pcie_probe+0x324/0x6f4
>>    platform_probe+0x5c/0x98
>>    really_probe+0xbc/0x29c
>>    __driver_probe_device+0x78/0x12c
>>    driver_probe_device+0xd8/0x160
>>    __device_attach_driver+0xb8/0x138
>>    bus_for_each_drv+0x84/0xe4
>>    __device_attach_async_helper+0xb8/0xdc
>>    async_run_entry_fn+0x34/0xe0
>>    process_one_work+0x220/0x694
>>    worker_thread+0x1c0/0x36c
>>    kthread+0x14c/0x224
>>
>> Fixes: 82c56b6dd24f ("phy: freescale: imx8qm-hsio: Add i.MX8QM HSIO PHY driver support")
>> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
>> ---
>>   drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
>> index 5dca93cd325c..9453ab98e475 100644
>> --- a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
>> +++ b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c
>> @@ -545,6 +545,7 @@ static int imx_hsio_probe(struct platform_device *pdev)
>>                return -ENOMEM;
>>        priv->dev = &pdev->dev;
>>        priv->drvdata = of_device_get_match_data(dev);
>> +     mutex_init(&priv->lock);
> use devm_mutex_init()

Thanks for the suggestion, I will send v2

thanks

xiaolei

>
> Frank
>>        /* Get HSIO configuration mode */
>>        if (of_property_read_string(np, "fsl,hsio-cfg", &priv->hsio_cfg))
>> --
>> 2.43.0
>>