2023-07-25 03:29:50

by Minjie Du

[permalink] [raw]
Subject: [PATCH v5] ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer()

It is possible for dma_request_chan() to return EPROBE_DEFER, which means
acdev->host->dev is not ready yet.
At this point dev_err() will have no output.

Signed-off-by: Minjie Du <[email protected]>
---
V2 -> V5: Fixed code formatting errors.
---
drivers/ata/pata_arasan_cf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 6ab294322e79..b32d47112c0a 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -529,7 +529,8 @@ static void data_xfer(struct work_struct *work)
/* dma_request_channel may sleep, so calling from process context */
acdev->dma_chan = dma_request_chan(acdev->host->dev, "data");
if (IS_ERR(acdev->dma_chan)) {
- dev_err(acdev->host->dev, "Unable to get dma_chan\n");
+ dev_err_probe(acdev->host->dev, PTR_ERR(acdev->dma_chan),
+ "Unable to get dma_chan\n");
acdev->dma_chan = NULL;
goto chan_request_fail;
}
--
2.39.0



2023-07-25 05:36:04

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v5] ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer()

On 25-07-23, 11:06, Minjie Du wrote:
> It is possible for dma_request_chan() to return EPROBE_DEFER, which means
> acdev->host->dev is not ready yet.
> At this point dev_err() will have no output.
>
> Signed-off-by: Minjie Du <[email protected]>
> ---
> V2 -> V5: Fixed code formatting errors.
> ---
> drivers/ata/pata_arasan_cf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
> index 6ab294322e79..b32d47112c0a 100644
> --- a/drivers/ata/pata_arasan_cf.c
> +++ b/drivers/ata/pata_arasan_cf.c
> @@ -529,7 +529,8 @@ static void data_xfer(struct work_struct *work)
> /* dma_request_channel may sleep, so calling from process context */
> acdev->dma_chan = dma_request_chan(acdev->host->dev, "data");
> if (IS_ERR(acdev->dma_chan)) {
> - dev_err(acdev->host->dev, "Unable to get dma_chan\n");
> + dev_err_probe(acdev->host->dev, PTR_ERR(acdev->dma_chan),
> + "Unable to get dma_chan\n");
> acdev->dma_chan = NULL;
> goto chan_request_fail;
> }

Missed it last time, but the formatting looks okay now I guess.

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2023-07-25 10:16:33

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH v5] ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer()

On 7/25/23 6:06 AM, Minjie Du wrote:

> It is possible for dma_request_chan() to return EPROBE_DEFER, which means
> acdev->host->dev is not ready yet.
> At this point dev_err() will have no output.

It will, else the patch wouldn't have been needed, right?

> Signed-off-by: Minjie Du <[email protected]>
> ---
> V2 -> V5: Fixed code formatting errors.
> ---
> drivers/ata/pata_arasan_cf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
> index 6ab294322e79..b32d47112c0a 100644
> --- a/drivers/ata/pata_arasan_cf.c
> +++ b/drivers/ata/pata_arasan_cf.c
> @@ -529,7 +529,8 @@ static void data_xfer(struct work_struct *work)
> /* dma_request_channel may sleep, so calling from process context */
> acdev->dma_chan = dma_request_chan(acdev->host->dev, "data");
> if (IS_ERR(acdev->dma_chan)) {
> - dev_err(acdev->host->dev, "Unable to get dma_chan\n");
> + dev_err_probe(acdev->host->dev, PTR_ERR(acdev->dma_chan),
> + "Unable to get dma_chan\n");
> acdev->dma_chan = NULL;
> goto chan_request_fail;
> }

Reviewed-by: Sergey Shtylyov <[email protected]>

[...]

MBR, Sergey

2023-07-26 01:09:07

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH v5] ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer()

On 7/25/23 12:06, Minjie Du wrote:
> It is possible for dma_request_chan() to return EPROBE_DEFER, which means
> acdev->host->dev is not ready yet.
> At this point dev_err() will have no output.
>
> Signed-off-by: Minjie Du <[email protected]>

Applied to for-6.5-fixes. Thanks !

--
Damien Le Moal
Western Digital Research