]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
mmc: sh-mmcif: avoid oops on spurious interrupts (second try)
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 22 Aug 2012 06:49:47 +0000 (06:49 +0000)
committerChris Ball <cjb@laptop.org>
Thu, 6 Dec 2012 18:54:35 +0000 (13:54 -0500)
On some systems, e.g., kzm9g, MMCIF interfaces can produce spurious
interrupts without any active request. To prevent the Oops, that results
in such cases, don't dereference the mmc request pointer until we make
sure, that we are indeed processing such a request.

Reported-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Cc: stable@vger.kernel.org
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sh_mmcif.c

index 43cd0b54db07524ee7f6555d3209df888d03fddd..7eaee3eeb6b2bffed13af54651e6ad5e19d0b409 100644 (file)
@@ -1104,7 +1104,6 @@ static irqreturn_t sh_mmcif_irqt(int irq, void *dev_id)
 {
        struct sh_mmcif_host *host = dev_id;
        struct mmc_request *mrq = host->mrq;
 {
        struct sh_mmcif_host *host = dev_id;
        struct mmc_request *mrq = host->mrq;
-       struct mmc_data *data = mrq->data;
 
        cancel_delayed_work_sync(&host->timeout_work);
 
 
        cancel_delayed_work_sync(&host->timeout_work);
 
@@ -1152,13 +1151,14 @@ static irqreturn_t sh_mmcif_irqt(int irq, void *dev_id)
        case MMCIF_WAIT_FOR_READ_END:
        case MMCIF_WAIT_FOR_WRITE_END:
                if (host->sd_error)
        case MMCIF_WAIT_FOR_READ_END:
        case MMCIF_WAIT_FOR_WRITE_END:
                if (host->sd_error)
-                       data->error = sh_mmcif_error_manage(host);
+                       mrq->data->error = sh_mmcif_error_manage(host);
                break;
        default:
                BUG();
        }
 
        if (host->wait_for != MMCIF_WAIT_FOR_STOP) {
                break;
        default:
                BUG();
        }
 
        if (host->wait_for != MMCIF_WAIT_FOR_STOP) {
+               struct mmc_data *data = mrq->data;
                if (!mrq->cmd->error && data && !data->error)
                        data->bytes_xfered =
                                data->blocks * data->blksz;
                if (!mrq->cmd->error && data && !data->error)
                        data->bytes_xfered =
                                data->blocks * data->blksz;