lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260130104832.00005890@huawei.com>
Date: Fri, 30 Jan 2026 10:48:32 +0000
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Abdurrahman Hussain via B4 Relay
	<devnull+abdurrahman.nexthop.ai@...nel.org>
CC: <abdurrahman@...thop.ai>, Michal Simek <michal.simek@....com>, Andi Shyti
	<andi.shyti@...nel.org>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
	<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Andy Shevchenko
	<andriy.shevchenko@...el.com>, <linux-arm-kernel@...ts.infradead.org>,
	<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<devicetree@...r.kernel.org>
Subject: Re: [PATCH v7 2/6] i2c: xiic: switch to devres managed APIs

On Thu, 29 Jan 2026 21:43:14 +0000
Abdurrahman Hussain via B4 Relay <devnull+abdurrahman.nexthop.ai@...nel.org> wrote:

> From: Abdurrahman Hussain <abdurrahman@...thop.ai>
> 
> Simplify the error code paths by switching to devres managed helper
> functions.
> 
> Signed-off-by: Abdurrahman Hussain <abdurrahman@...thop.ai>
> ---
>  drivers/i2c/busses/i2c-xiic.c | 28 +++++++++++-----------------
>  1 file changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 912a94d4d080..a480cbb86d93 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -1462,7 +1462,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	snprintf(i2c->adap.name, sizeof(i2c->adap.name),
>  		 DRIVER_NAME " %s", pdev->name);
>  
> -	mutex_init(&i2c->lock);
> +	ret = devm_mutex_init(dev, &i2c->lock);
> +	if (ret)
> +		return ret;
> +
>  	spin_lock_init(&i2c->atomic_lock);
>  
>  	if (is_of_node(dev->fwnode)) {
> @@ -1475,8 +1478,9 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	i2c->dev = &pdev->dev;
>  	pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT);
>  	pm_runtime_use_autosuspend(i2c->dev);
> -	pm_runtime_set_active(i2c->dev);
> -	pm_runtime_enable(i2c->dev);
> +	ret = devm_pm_runtime_set_active_enabled(dev);
> +	if (ret)
> +		return ret;
>  
>  	/* SCL frequency configuration */
>  	i2c->input_clk = clk_get_rate(i2c->clk);
> @@ -1492,7 +1496,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  
>  	if (ret < 0) {
>  		dev_err_probe(&pdev->dev, ret, "Cannot claim IRQ\n");
> -		goto err_pm_disable;
> +		return ret;

		return dev_err_probe();

>  	}
>  
>  	i2c->singlemaster =
> @@ -1511,16 +1515,14 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  		i2c->endianness = BIG;
>  
>  	ret = xiic_reinit(i2c);
> -	if (ret < 0) {
> -		dev_err_probe(&pdev->dev, ret, "Cannot xiic_reinit\n");
> -		goto err_pm_disable;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Cannot xiic_reinit\n");
>  
>  	/* add i2c adapter to i2c tree */
>  	ret = i2c_add_adapter(&i2c->adap);
>  	if (ret) {
>  		xiic_deinit(i2c);
> -		goto err_pm_disable;
> +		return ret;
>  	}
>  
>  	if (pdata) {
> @@ -1532,12 +1534,6 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	dev_dbg(&pdev->dev, "mmio %08lx irq %d scl clock frequency %d\n",
>  		(unsigned long)res->start, irq, i2c->i2c_clk);
>  
> -	return 0;
> -
> -err_pm_disable:
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
> -
>  	return ret;
>  }
>  
> @@ -1558,8 +1554,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
>  		xiic_deinit(i2c);
>  
>  	pm_runtime_put_sync(i2c->dev);
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
>  	pm_runtime_dont_use_autosuspend(&pdev->dev);
>  }
>  
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ