Skip to contentSkip to conversation

mmc: sdhci-pxav2: Remove unnecessary null pointer check

PATCH In review Doug Brown 3 participants 3 messages Jul 14, 2024 – Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore

Doug Brown

author
#0 lore raw

PATCH 1/1 mmc: sdhci-pxav2: Remove unnecessary null pointer check

There is no need to check for a null mrq->cmd in pxav1_request_done. mmc_request_done already assumes it's not null, and it's always called in this path by every SDHCI driver. This was caught by Smatch.

---
 drivers/mmc/host/sdhci-pxav2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pxav2.c +1 -1
index b75cbea88b40..7b957f6d5588 100644
@@ -126,7 +126,7 @@ static void pxav1_request_done(struct sdhci_host *host, struct mmc_request *mrq)
 	struct sdhci_pxav2_host *pxav2_host;
 
 	/* If this is an SDIO command, perform errata workaround for silicon bug */
-	if (mrq->cmd && !mrq->cmd->error &&
+	if (!mrq->cmd->error &&
 	    (mrq->cmd->opcode == SD_IO_RW_DIRECT ||
 	     mrq->cmd->opcode == SD_IO_RW_EXTENDED)) {
 		/* Reset data port */
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Doug Brown

There is no need to check for a null mrq->cmd in pxav1_request_done. mmc_request_done already assumes it's not null, and it's always called in this path by every SDHCI driver. This was caught by Smatch.

Quoted 17 lines
---
 drivers/mmc/host/sdhci-pxav2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pxav2.c +1 -1
index b75cbea88b40..7b957f6d5588 100644
@@ -126,7 +126,7 @@ static void pxav1_request_done(struct sdhci_host *host, struct mmc_request *mrq)
 	struct sdhci_pxav2_host *pxav2_host;
 
 	/* If this is an SDIO command, perform errata workaround for silicon bug */
-	if (mrq->cmd && !mrq->cmd->error &&
+	if (!mrq->cmd->error &&
 	    (mrq->cmd->opcode == SD_IO_RW_DIRECT ||
 	     mrq->cmd->opcode == SD_IO_RW_EXTENDED)) {
 		/* Reset data port */
#2 lore raw
In reply to Doug Brown
Quoted 8 lines · Doug Brown

There is no need to check for a null mrq->cmd in pxav1_request_done. mmc_request_done already assumes it's not null, and it's always called in this path by every SDHCI driver. This was caught by Smatch.

Applied for next, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/sdhci-pxav2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pxav2.c +1 -2
index b75cbea88b40..7b957f6d5588 100644
@@ -126,7 +126,7 @@ static void pxav1_request_done(struct sdhci_host *host, struct mmc_request *mrq)
        struct sdhci_pxav2_host *pxav2_host;
 
        /* If this is an SDIO command, perform errata workaround for silicon bug */
-       if (mrq->cmd && !mrq->cmd->error &&
+       if (!mrq->cmd->error &&
            (mrq->cmd->opcode == SD_IO_RW_DIRECT ||
             mrq->cmd->opcode == SD_IO_RW_EXTENDED)) {
                /* Reset data port */
--

2.34.1