Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: jz4740: Use dev_err_probe()
@ 2023-03-22  9:07 ye.xingchen
  2023-03-22  9:18 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: ye.xingchen @ 2023-03-22  9:07 UTC (permalink / raw)
  To: ulf.hansson; +Cc: paul, linux-mips, linux-mmc, linux-kernel

From: Ye Xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with dev_err_probe() to simplify the code.

Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
---
 drivers/mmc/host/jz4740_mmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index 698450afa7bb..a6ad03b24add 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -232,10 +232,7 @@ static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
 	if (!IS_ERR(host->dma_tx))
 		return 0;

-	if (PTR_ERR(host->dma_tx) != -ENODEV) {
-		dev_err(dev, "Failed to get dma tx-rx channel\n");
-		return PTR_ERR(host->dma_tx);
-	}
+	return dev_err_probe(dev, PTR_ERR(host->dma_tx), "Failed to get dma tx-rx channel\n");

 	host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
 	if (IS_ERR(host->dma_tx)) {
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: jz4740: Use dev_err_probe()
  2023-03-22  9:07 [PATCH] mmc: jz4740: Use dev_err_probe() ye.xingchen
@ 2023-03-22  9:18 ` Sergei Shtylyov
  2023-03-22  9:25   ` Paul Cercueil
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2023-03-22  9:18 UTC (permalink / raw)
  To: ye.xingchen, ulf.hansson; +Cc: paul, linux-mips, linux-mmc, linux-kernel

On 3/22/23 12:07 PM, ye.xingchen@zte.com.cn wrote:

> From: Ye Xingchen <ye.xingchen@zte.com.cn>
> 
> Replace the open-code with dev_err_probe() to simplify the code.
> 
> Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/mmc/host/jz4740_mmc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
> index 698450afa7bb..a6ad03b24add 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -232,10 +232,7 @@ static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
>  	if (!IS_ERR(host->dma_tx))
>  		return 0;
> 
> -	if (PTR_ERR(host->dma_tx) != -ENODEV) {
> -		dev_err(dev, "Failed to get dma tx-rx channel\n");
> -		return PTR_ERR(host->dma_tx);
> -	}
> +	return dev_err_probe(dev, PTR_ERR(host->dma_tx), "Failed to get dma tx-rx channel\n");

   I'm afraid this makes the following code unreachable...

> 
>  	host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
>  	if (IS_ERR(host->dma_tx)) {

MBR, Sergey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: jz4740: Use dev_err_probe()
  2023-03-22  9:18 ` Sergei Shtylyov
@ 2023-03-22  9:25   ` Paul Cercueil
  2023-03-22 16:54     ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Cercueil @ 2023-03-22  9:25 UTC (permalink / raw)
  To: Sergei Shtylyov, ye.xingchen, ulf.hansson
  Cc: linux-mips, linux-mmc, linux-kernel

Le mercredi 22 mars 2023 à 12:18 +0300, Sergei Shtylyov a écrit :
> On 3/22/23 12:07 PM, ye.xingchen@zte.com.cn wrote:
> 
> > From: Ye Xingchen <ye.xingchen@zte.com.cn>
> > 
> > Replace the open-code with dev_err_probe() to simplify the code.
> > 
> > Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> > ---
> >  drivers/mmc/host/jz4740_mmc.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/jz4740_mmc.c
> > b/drivers/mmc/host/jz4740_mmc.c
> > index 698450afa7bb..a6ad03b24add 100644
> > --- a/drivers/mmc/host/jz4740_mmc.c
> > +++ b/drivers/mmc/host/jz4740_mmc.c
> > @@ -232,10 +232,7 @@ static int
> > jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
> >         if (!IS_ERR(host->dma_tx))
> >                 return 0;
> > 
> > -       if (PTR_ERR(host->dma_tx) != -ENODEV) {
> > -               dev_err(dev, "Failed to get dma tx-rx channel\n");
> > -               return PTR_ERR(host->dma_tx);
> > -       }
> > +       return dev_err_probe(dev, PTR_ERR(host->dma_tx), "Failed to
> > get dma tx-rx channel\n");
> 
>    I'm afraid this makes the following code unreachable...

Also, this is not a probe(), so I don't see a point of using
dev_err_probe() here.

Cheers,
-Paul

> 
> > 
> >         host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
> >         if (IS_ERR(host->dma_tx)) {
> 
> MBR, Sergey


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: jz4740: Use dev_err_probe()
  2023-03-22  9:25   ` Paul Cercueil
@ 2023-03-22 16:54     ` Lars-Peter Clausen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2023-03-22 16:54 UTC (permalink / raw)
  To: Paul Cercueil, Sergei Shtylyov, ye.xingchen, ulf.hansson
  Cc: linux-mips, linux-mmc, linux-kernel

On 3/22/23 02:25, Paul Cercueil wrote:
> Le mercredi 22 mars 2023 à 12:18 +0300, Sergei Shtylyov a écrit :
>> On 3/22/23 12:07 PM, ye.xingchen@zte.com.cn wrote:
>>
>>> From: Ye Xingchen <ye.xingchen@zte.com.cn>
>>>
>>> Replace the open-code with dev_err_probe() to simplify the code.
>>>
>>> Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
>>> ---
>>>   drivers/mmc/host/jz4740_mmc.c | 5 +----
>>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/jz4740_mmc.c
>>> b/drivers/mmc/host/jz4740_mmc.c
>>> index 698450afa7bb..a6ad03b24add 100644
>>> --- a/drivers/mmc/host/jz4740_mmc.c
>>> +++ b/drivers/mmc/host/jz4740_mmc.c
>>> @@ -232,10 +232,7 @@ static int
>>> jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
>>>          if (!IS_ERR(host->dma_tx))
>>>                  return 0;
>>>
>>> -       if (PTR_ERR(host->dma_tx) != -ENODEV) {
>>> -               dev_err(dev, "Failed to get dma tx-rx channel\n");
>>> -               return PTR_ERR(host->dma_tx);
>>> -       }
>>> +       return dev_err_probe(dev, PTR_ERR(host->dma_tx), "Failed to
>>> get dma tx-rx channel\n");
>>     I'm afraid this makes the following code unreachable...
> Also, this is not a probe(), so I don't see a point of using
> dev_err_probe() here.
The function is only called from probe(), I think it makes sense to use 
dev_err_probe() here.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-22 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22  9:07 [PATCH] mmc: jz4740: Use dev_err_probe() ye.xingchen
2023-03-22  9:18 ` Sergei Shtylyov
2023-03-22  9:25   ` Paul Cercueil
2023-03-22 16:54     ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox