mmc: sdhci-pxav2: Remove unnecessary null pointer check
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.
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Doug Brown <[email protected]>
--- drivers/mmc/host/sdhci-pxav2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pxav2.c +1 -1
@@ -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
Quoted 7 lines · Doug Brown
There is no need to check for a null
mrq->cmdinpxav1_request_done.mmc_request_donealready assumes it's not null, and it's always called in this path by every SDHCI driver. This was caught by Smatch.Reported-by Dan Carpenter <[email protected]>Signed-off-by Doug Brown <[email protected]>
Acked-by Adrian Hunter <[email protected]>
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@@ -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 */
Quoted 8 lines · Doug Brown
There is no need to check for a null
mrq->cmdinpxav1_request_done.mmc_request_donealready assumes it's not null, and it's always called in this path by every SDHCI driver. This was caught by Smatch.Reported-by Dan Carpenter <[email protected]>Signed-off-by Doug Brown <[email protected]>
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@@ -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