[PATCH] i2c: designware-platdrv: handle reset control deassert error

Artem Shimko posted 1 patch 2 months, 1 week ago
There is a newer version of this series
drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] i2c: designware-platdrv: handle reset control deassert error
Posted by Artem Shimko 2 months, 1 week ago
Handle the error returned by reset_control_deassert() in the probe
function to prevent continuing probe when reset deassertion fails.

Previously, reset_control_deassert() was called without checking its
return value, which could lead to probe continuing even when the
device reset wasn't properly deasserted.

The fix checks the return value and returns an error with dev_err_probe()
if reset deassertion fails, providing better error handling and
diagnostics.

Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
Hi Philipp,

Oh, sorry, sure.

Could you please have a look at the v2.

Thank you

Best regards,
Artem Shimko

ChangeLog:
  v1:
    * https://lore.kernel.org/all/20251009074443.2010699-1-a.shimko.dev@gmail.com/
  v2:
    * change pdev->dev to local device dev

 drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index a35e4c64a1d4..c89af7cbdfac 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -240,7 +240,9 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (IS_ERR(dev->rst))
 		return PTR_ERR(dev->rst);
 
-	reset_control_deassert(dev->rst);
+	ret = reset_control_deassert(dev->rst);
+	if (ret)
+		return dev_err_probe(device, ret, "Failed to deassert reset\n");
 
 	ret = i2c_dw_fw_parse_and_configure(dev);
 	if (ret)
-- 
2.43.0
Re: [PATCH] i2c: designware-platdrv: handle reset control deassert error
Posted by Philipp Zabel 2 months, 1 week ago
On Do, 2025-10-09 at 11:37 +0300, Artem Shimko wrote:
> Handle the error returned by reset_control_deassert() in the probe
> function to prevent continuing probe when reset deassertion fails.
> 
> Previously, reset_control_deassert() was called without checking its
> return value, which could lead to probe continuing even when the
> device reset wasn't properly deasserted.
> 
> The fix checks the return value and returns an error with dev_err_probe()
> if reset deassertion fails, providing better error handling and
> diagnostics.
> 
> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
Re: [PATCH] i2c: designware-platdrv: handle reset control deassert error
Posted by Artem Shimko 1 month, 3 weeks ago
On Thu, Oct 9, 2025 at 12:39 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> On Do, 2025-10-09 at 11:37 +0300, Artem Shimko wrote:
> > Handle the error returned by reset_control_deassert() in the probe
> > function to prevent continuing probe when reset deassertion fails.
> >
> > Previously, reset_control_deassert() was called without checking its
> > return value, which could lead to probe continuing even when the
> > device reset wasn't properly deasserted.
> >
> > The fix checks the return value and returns an error with dev_err_probe()
> > if reset deassertion fails, providing better error handling and
> > diagnostics.
> >
> > Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
>
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

Hi Philipp,

Should I do something to bring the changes to linux-next?

--
Best regards,
Artem
Re: [PATCH] i2c: designware-platdrv: handle reset control deassert error
Posted by Mika Westerberg 2 months, 1 week ago
Hi,

On Thu, Oct 09, 2025 at 11:37:03AM +0300, Artem Shimko wrote:
> Handle the error returned by reset_control_deassert() in the probe
> function to prevent continuing probe when reset deassertion fails.
> 
> Previously, reset_control_deassert() was called without checking its
> return value, which could lead to probe continuing even when the
> device reset wasn't properly deasserted.
> 
> The fix checks the return value and returns an error with dev_err_probe()
> if reset deassertion fails, providing better error handling and
> diagnostics.
> 
> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>

Looks good to me,

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>