From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Petr Cvek <petr.cvek@tul.cz>
Cc: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] mmc: pxamci: Enhance error checking
Date: Wed, 19 Apr 2017 21:12:11 +0200 [thread overview]
Message-ID: <87o9vs6wl0.fsf@belgarion.home> (raw)
In-Reply-To: a8769ce8-2732-1f23-eaca-33591951ee78@tul.cz
Petr Cvek <petr.cvek@tul.cz> writes:
> The pxamci_dma_irq() and pxamci_data_done() should print errors if they
> obtains invalid parameters. Make the pxamci_dma_irq() call with
> the MMC_DATA_READ flag a fault as the DMA callback is used only for write.
>
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
> ---
> drivers/mmc/host/pxamci.c | 33 ++++++++++++++++++++++++---------
> 1 file changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
> index 80bc8065b50f..48c26d848e9f 100644
> --- a/drivers/mmc/host/pxamci.c
> +++ b/drivers/mmc/host/pxamci.c
> @@ -354,13 +354,22 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
> struct mmc_data *data = host->data;
> struct dma_chan *chan;
>
> - if (!data)
> + if (!data) {
> + pr_err("%s: Missing data structure\n",
> + mmc_hostname(host->mmc));
I'd rather have :
dev_err(mmc_dev(mmc), ...)
> return 0;
> + }
>
> if (data->flags & MMC_DATA_READ)
> chan = host->dma_chan_rx;
> - else
> + else if (data->flags & MMC_DATA_WRITE)
> chan = host->dma_chan_tx;
> + else {
> + pr_err("%s: Unknown data direction, flags=%08x\n",
> + mmc_hostname(host->mmc), data->flags);
Ditto.
> + if (!host->data) {
> + pr_err("%s: Missing data structure\n",
> + mmc_hostname(host->mmc));
Ditto.
> goto out_unlock;
> + }
>
> - if (host->data->flags & MMC_DATA_READ)
> - chan = host->dma_chan_rx;
> - else
> - chan = host->dma_chan_tx;
> + if (!(host->data->flags & MMC_DATA_WRITE)) {
> + pr_err("%s: DMA callback is only for tx channel, flags=%x\n",
> + mmc_hostname(host->mmc), host->data->flags);
Ditto.
> + goto out_unlock;
> + }
> +
> + chan = host->dma_chan_tx;
>
> status = dmaengine_tx_status(chan, host->dma_cookie, &state);
>
> if (likely(status == DMA_COMPLETE)) {
> writel(BUF_PART_FULL, host->base + MMC_PRTBUF);
> } else {
> - pr_err("%s: DMA error on %s channel\n", mmc_hostname(host->mmc),
> - host->data->flags & MMC_DATA_READ ? "rx" : "tx");
> + pr_err("%s: Invalid DMA status %i\n", mmc_hostname(host->mmc),
> + status);
Ditto.
Cheers.
--
Robert
next prev parent reply other threads:[~2017-04-19 19:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1492492523.git.petr.cvek@tul.cz>
2017-04-18 23:16 ` [PATCH 1/4] mmc: pxamci: Use the right flags for DMA callback init Petr Cvek
2017-04-21 0:31 ` Petr Cvek
2017-04-18 23:17 ` [PATCH 2/4] mmc: pxamci: Enhance error checking Petr Cvek
2017-04-19 19:12 ` Robert Jarzmik [this message]
2017-04-18 23:17 ` [PATCH 3/4] mmc: pxamci: Disable DATA_TRAN_DONE interrupt sooner Petr Cvek
2017-04-19 19:14 ` Robert Jarzmik
2017-04-20 23:37 ` Petr Cvek
2017-04-18 23:18 ` [PATCH 4/4] mmc: pxamci: Fix race condition between pxamci_dma_irq() and pxamci_irq() Petr Cvek
2017-04-19 19:22 ` Robert Jarzmik
2017-04-21 1:30 ` Petr Cvek
2017-04-27 13:14 ` Robert Jarzmik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o9vs6wl0.fsf@belgarion.home \
--to=robert.jarzmik@free.fr \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=petr.cvek@tul.cz \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox