All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] mmc: cavium: Add core MMC driver for Cavium SOCs
@ 2017-04-12 19:54 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-04-12 19:54 UTC (permalink / raw)
  To: jglauber; +Cc: linux-mmc

Hello Jan Glauber,

This is a semi-automatic email about new static checker warnings.

The patch 8047c753f3d3: "mmc: cavium: Add core MMC driver for Cavium 
SOCs" from Mar 30, 2017, leads to the following Smatch complaint:

drivers/mmc/host/cavium.c:694 cvm_mmc_dma_request()
	 warn: variable dereferenced before check 'mmc->card' (see line 675)

drivers/mmc/host/cavium.c
   674	
   675		emm_dma = prepare_ext_dma(mmc, mrq);
                                          ^^^
Dereferenced inside this function call.

   676		addr = prepare_dma(host, data);
   677		if (!addr) {
   678			dev_err(host->dev, "prepare_dma failed\n");
   679			goto error;
   680		}
   681	
   682		host->dma_active = true;
   683		host->int_enable(host, MIO_EMM_INT_CMD_ERR | MIO_EMM_INT_DMA_DONE |
   684				 MIO_EMM_INT_DMA_ERR);
   685	
   686		if (host->dmar_fixup)
   687			host->dmar_fixup(host, mrq->cmd, data, addr);
   688	
   689		/*
   690		 * If we have a valid SD card in the slot, we set the response
   691		 * bit mask to check for CRC errors and timeouts only.
   692		 * Otherwise, use the default power reset value.
   693		 */
   694		if (mmc->card && mmc_card_sd(mmc->card))
                    ^^^^^^^^^
Checked too late.

   695			writeq(0x00b00000ull, host->base + MIO_EMM_STS_MASK(host));
   696		else

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [bug report] mmc: cavium: Add core MMC driver for Cavium SOCs
@ 2017-04-12 20:31 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-04-12 20:31 UTC (permalink / raw)
  To: jglauber; +Cc: linux-mmc

Hello Jan Glauber,

This is a semi-automatic email about new static checker warnings.

The patch 8047c753f3d3: "mmc: cavium: Add core MMC driver for Cavium 
SOCs" from Mar 30, 2017, leads to the following Smatch complaint:

drivers/mmc/host/cavium.c:803 cvm_mmc_request()
	 error: we previously assumed 'cmd->data' could be null (see line 782)

drivers/mmc/host/cavium.c
   781	
   782		if (cmd->data) {
                    ^^^^^^^^^
Check.

   783			if (cmd->data->flags & MMC_DATA_READ)
   784				do_read_request(host, mrq);
   785			else
   786				do_write_request(host, mrq);
   787	
   788			if (cmd->data->timeout_ns)
   789				set_wdog(slot, cmd->data->timeout_ns);
   790		} else
   791			set_wdog(slot, 0);
   792	
   793		host->dma_active = false;
   794		host->int_enable(host, MIO_EMM_INT_CMD_DONE | MIO_EMM_INT_CMD_ERR);
   795	
   796		emm_cmd = FIELD_PREP(MIO_EMM_CMD_VAL, 1) |
   797			  FIELD_PREP(MIO_EMM_CMD_CTYPE_XOR, mods.ctype_xor) |
   798			  FIELD_PREP(MIO_EMM_CMD_RTYPE_XOR, mods.rtype_xor) |
   799			  FIELD_PREP(MIO_EMM_CMD_IDX, cmd->opcode) |
   800			  FIELD_PREP(MIO_EMM_CMD_ARG, cmd->arg);
   801		set_bus_id(&emm_cmd, slot->bus_id);
   802		if (mmc_cmd_type(cmd) == MMC_CMD_ADTC)
   803			emm_cmd |= FIELD_PREP(MIO_EMM_CMD_OFFSET,
   804					64 - ((cmd->data->blocks * cmd->data->blksz) / 8));
                                               ^^^^^^^^^^^         ^^^^^^^^^^^
Unchecked dereferences.  These are maybe false postives if == MMC_CMD_ADTC
implies data is non-NULL.  In that case, don't worry about it, this is
a one time email.

   805	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-12 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 19:54 [bug report] mmc: cavium: Add core MMC driver for Cavium SOCs Dan Carpenter
2017-04-12 20:31 Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.