Re: [PATCH 02/10] i2c: tegra: Replace dev_err() with dev_err_probe() in probe function

Jon Hunter
2026-03-24T21:06:04Z

On 24/03/2026 18:26, Atharv Dubey wrote:
> From: Enrico Zanda <e.zanda1@gmail.com>
>
> This simplifies the code while improving log.
>
> Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
> ---
> drivers/i2c/busses/i2c-tegra.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index bec619b9af4e..51d15fca82fc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -575,8 +575,8 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
> dma_buf = dma_alloc_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size,
> &dma_phys, GFP_KERNEL | __GFP_NOWARN);
> if (!dma_buf) {
> - dev_err(i2c_dev->dev, "failed to allocate DMA buffer\n");
> - err = -ENOMEM;
> + err = dev_err_probe(i2c_dev->dev, -ENOMEM,
> + "failed to allocate DMA buffer\n");

So this will never be a probe defer, so why bother?

> goto err_out;
> }
>
> @@ -588,8 +588,8 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
> err_out:
> tegra_i2c_release_dma(i2c_dev);
> if (err != -EPROBE_DEFER) {
> - dev_err(i2c_dev->dev, "cannot use DMA: %d\n", err);
> - dev_err(i2c_dev->dev, "falling back to PIO\n");
> + dev_err_probe(i2c_dev->dev, err,
> + "cannot use DMA, falling back to PIO\n");

This is not right.

> return 0;
> }
>
> @@ -1953,7 +1953,7 @@ static int tegra_i2c_init_clocks(struct tegra_i2c_dev *i2c_dev)
>
> err = clk_enable(i2c_dev->div_clk);
> if (err) {
> - dev_err(i2c_dev->dev, "failed to enable div-clk: %d\n", err);
> + dev_err_probe(i2c_dev->dev, err, "failed to enable div-clk\n");

We have already got the clock and so I don't think that this is needed
either.

> goto unprepare_clocks;
> }
>
> @@ -1979,7 +1979,7 @@ static int tegra_i2c_init_hardware(struct tegra_i2c_dev *i2c_dev)
>
> ret = pm_runtime_get_sync(i2c_dev->dev);
> if (ret < 0)
> - dev_err(i2c_dev->dev, "runtime resume failed: %d\n", ret);
> + dev_err_probe(i2c_dev->dev, ret, "runtime resume failed\n");

I don't think that this is needed either.

> else
> ret = tegra_i2c_init(i2c_dev);
>
>

--
nvpublic