A failure while processing the start command could cause dma_unmap_sg()
to be called without first calling dma_map_sg().
Since calling dma_unmap_sg() is only needed when data != NULL, move the
unmap call into the corresponding if {} block.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/* then wait command done */
if (msdc_command_resp(host, cmd, 1, CMD_TIMEOUT) != 0)
- goto done;
+ goto unmap;
/* for read, the data coming too fast, then CRC error
* start DMA no business with CRC.
/* Last: stop transfer */
if (data->stop) {
if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0)
- goto done;
+ goto unmap;
}
- }
-done:
- if (data) {
+unmap:
host->data = NULL;
dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len,
mmc_get_dma_dir(data));
host->blksz = 0;
}
+done:
if (mrq->cmd->error)
host->error = 0x001;
if (mrq->data && mrq->data->error)