[bug report] mmc: sdhci-pxav2: add SDIO card IRQ workaround for PXA168 V1 controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Doug Brown,

Commit 24552ccb4f1e ("mmc: sdhci-pxav2: add SDIO card IRQ workaround
for PXA168 V1 controller") from Jan 16, 2023 (linux-next), leads to
the following Smatch static checker warning:

	drivers/mmc/host/sdhci-pxav2.c:154 pxav1_request_done()
	error: we previously assumed 'mrq->cmd' could be null (see line 129)

drivers/mmc/host/sdhci-pxav2.c
    123 static void pxav1_request_done(struct sdhci_host *host, struct mmc_request *mrq)
    124 {
    125         u16 tmp;
    126         struct sdhci_pxav2_host *pxav2_host;
    127 
    128         /* If this is an SDIO command, perform errata workaround for silicon bug */
    129         if (mrq->cmd && !mrq->cmd->error &&
                    ^^^^^^^^
If mrq->cmd is NULL

    130             (mrq->cmd->opcode == SD_IO_RW_DIRECT ||
    131              mrq->cmd->opcode == SD_IO_RW_EXTENDED)) {
    132                 /* Reset data port */
    133                 tmp = readw(host->ioaddr + SDHCI_TIMEOUT_CONTROL);
    134                 tmp |= 0x400;
    135                 writew(tmp, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
    136 
    137                 /* Clock is now stopped, so restart it by sending a dummy CMD0 */
    138                 pxav2_host = sdhci_pltfm_priv(sdhci_priv(host));
    139                 pxav2_host->sdio_mrq = mrq;
    140 
    141                 /* Set CMD as high output rather than MMC function while we do CMD0 */
    142                 if (pxav2_host->pinctrl && pxav2_host->pins_cmd_gpio)
    143                         pinctrl_select_state(pxav2_host->pinctrl, pxav2_host->pins_cmd_gpio);
    144 
    145                 sdhci_writel(host, 0, SDHCI_ARGUMENT);
    146                 sdhci_writew(host, 0, SDHCI_TRANSFER_MODE);
    147                 sdhci_writew(host, SDHCI_MAKE_CMD(MMC_GO_IDLE_STATE, SDHCI_CMD_RESP_NONE),
    148                              SDHCI_COMMAND);
    149 
    150                 /* Don't finish this request until the dummy CMD0 finishes */
    151                 return;
    152         }
    153 
--> 154         mmc_request_done(host->mmc, mrq);
                                            ^^^
Then we are toasted because it will crash here

    155 }

regards,
dan carpenter




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux