diff mbox series

mmc: sdhci-pxav2: Remove unnecessary null pointer check

Message ID 20240714155510.48880-1-doug@schmorgal.com (mailing list archive)
State New
Headers show
Series mmc: sdhci-pxav2: Remove unnecessary null pointer check | expand

Commit Message

Doug Brown July 14, 2024, 3:55 p.m. UTC
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 <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/9ddaef2a-05bb-4fe7-98c5-da40a0813027@stanley.mountain/
Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/mmc/host/sdhci-pxav2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adrian Hunter July 15, 2024, 6:24 a.m. UTC | #1
On 14/07/24 18:55, Doug Brown wrote:
> 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 <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/9ddaef2a-05bb-4fe7-98c5-da40a0813027@stanley.mountain/
> Signed-off-by: Doug Brown <doug@schmorgal.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-pxav2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index b75cbea88b40..7b957f6d5588 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -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 */
Ulf Hansson Aug. 1, 2024, 11:01 a.m. UTC | #2
On Sun, 14 Jul 2024 at 17:57, Doug Brown <doug@schmorgal.com> wrote:
>
> 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 <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/9ddaef2a-05bb-4fe7-98c5-da40a0813027@stanley.mountain/
> Signed-off-by: Doug Brown <doug@schmorgal.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-pxav2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index b75cbea88b40..7b957f6d5588 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -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
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index b75cbea88b40..7b957f6d5588 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -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 */