Skip to contentSkip to conversation

mmc: jz4740: Use dev_err_probe()

PATCH In review [email protected] 4 participants 4 messages Mar 22, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: jz4740: Use dev_err_probe()

From: Ye Xingchen <[email protected]>

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

---
 drivers/mmc/host/jz4740_mmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/jz4740_mmc.c +1 -4
index 698450afa7bb..a6ad03b24add 100644
@@ -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)) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 14 lines · On 3/22/23 12:07 PM, [email protected] wrote:

From: Ye Xingchen <[email protected]>

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

---
 drivers/mmc/host/jz4740_mmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/jz4740_mmc.c +0 -0
index 698450afa7bb..a6ad03b24add 100644

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host) · line 235

Quoted 8 lines
drivers/mmc/host/jz4740_mmc.c +1 -4
@@ -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...

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host) · line 238

Quoted 3 lines
drivers/mmc/host/jz4740_mmc.c +0 -0
 	host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
 	if (IS_ERR(host->dma_tx)) {

MBR, Sergey

maintainer
#2 lore raw

Le mercredi 22 mars 2023 à 12:18 +0300, Sergei Shtylyov a écrit :

Quoted 21 lines · On 3/22/23 12:07 PM, [email protected] wrote:
Quoted 20 lines

From: Ye Xingchen <[email protected]>

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

---
 drivers/mmc/host/jz4740_mmc.c | 5 +----

 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/jz4740_mmc.c +0 -0
index 698450afa7bb..a6ad03b24add 100644
@@ -232,10 +232,7 @@ static int
 jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
         if (!IS_ERR(host->dma_tx))
                 return 0;
 
Quoted 8 lines

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)

Quoted 6 lines
drivers/mmc/host/jz4740_mmc.c +1 -4
-       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

Quoted 6 lines
Quoted 4 lines
drivers/mmc/host/jz4740_mmc.c +0 -0
         host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");

        if (IS_ERR(host->dma_tx)) {

MBR, Sergey

#3 lore raw
Quoted 29 lines · Paul Cercueil

Le mercredi 22 mars 2023 à 12:18 +0300, Sergei Shtylyov a écrit :

Quoted 21 lines · On 3/22/23 12:07 PM, [email protected] wrote:
Quoted 20 lines

From: Ye Xingchen <[email protected]>

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

---
  drivers/mmc/host/jz4740_mmc.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/jz4740_mmc.c +0 -0
index 698450afa7bb..a6ad03b24add 100644
@@ -232,10 +232,7 @@ static int
 jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)
         if (!IS_ERR(host->dma_tx))
                 return 0;
 
Quoted 7 lines

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)

Quoted 6 lines
drivers/mmc/host/jz4740_mmc.c +1 -4
-       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...

Quoted 2 lines

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.