aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-11-15 13:56:41 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2014-11-26 08:31:01 -0500
commit9e2a0c96efab30c85367176d1fc2c04906676458 (patch)
treedf21a221d9b5a7b42cc3142d33ae0e177bc0c337
parentecb89f2f5f3e771108a5595b0b4d1a1a974cc926 (diff)
mmc: toshsd: move dereference below check for NULL
We check for NULL pointers after dereferencing so it's too late. Oddly enough, Smatch misses this code but complains about the caller passing NULL pointers to this function: drivers/mmc/host/toshsd.c:389 toshsd_irq() error: we previously assumed 'host->cmd' could be null (see line 349) Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/toshsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/toshsd.c b/drivers/mmc/host/toshsd.c
index edb06d67c2f5..4666262edaca 100644
--- a/drivers/mmc/host/toshsd.c
+++ b/drivers/mmc/host/toshsd.c
@@ -206,14 +206,14 @@ static irqreturn_t toshsd_thread_irq(int irq, void *dev_id)
206static void toshsd_cmd_irq(struct toshsd_host *host) 206static void toshsd_cmd_irq(struct toshsd_host *host)
207{ 207{
208 struct mmc_command *cmd = host->cmd; 208 struct mmc_command *cmd = host->cmd;
209 u8 *buf = (u8 *) cmd->resp; 209 u8 *buf;
210 u16 data; 210 u16 data;
211 211
212 if (!host->cmd) { 212 if (!host->cmd) {
213 dev_warn(&host->pdev->dev, "Spurious CMD irq\n"); 213 dev_warn(&host->pdev->dev, "Spurious CMD irq\n");
214 return; 214 return;
215 } 215 }
216 216 buf = (u8 *)cmd->resp;
217 host->cmd = NULL; 217 host->cmd = NULL;
218 218
219 if (cmd->flags & MMC_RSP_PRESENT && cmd->flags & MMC_RSP_136) { 219 if (cmd->flags & MMC_RSP_PRESENT && cmd->flags & MMC_RSP_136) {