* [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator
@ 2015-08-19 13:41 Rabin Vincent
2015-08-19 13:41 ` [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print Rabin Vincent
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rabin Vincent @ 2015-08-19 13:41 UTC (permalink / raw)
To: ulf.hansson; +Cc: g.liakhovetski, linux-mmc, Rabin Vincent
We ignore errors from mmc_regulator_get_supply() because the usage of
the regulators is optional for the driver, but we still need to check
for and handle EPROBE_DEFER, like it's done in for example dw_mmc.
Otherwise we might end up not using the specified regulators just
because of probe order.
Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
drivers/mmc/host/usdhi6rol0.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 54b082b..63d5d72 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1715,12 +1715,14 @@ static int usdhi6_probe(struct platform_device *pdev)
if (!mmc)
return -ENOMEM;
+ ret = mmc_regulator_get_supply(mmc);
+ if (ret == -EPROBE_DEFER)
+ goto e_free_mmc;
+
ret = mmc_of_parse(mmc);
if (ret < 0)
goto e_free_mmc;
- mmc_regulator_get_supply(mmc);
-
host = mmc_priv(mmc);
host->mmc = mmc;
host->wait = USDHI6_WAIT_FOR_REQUEST;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print
2015-08-19 13:41 [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Rabin Vincent
@ 2015-08-19 13:41 ` Rabin Vincent
2015-08-25 12:07 ` Ulf Hansson
2015-08-19 13:41 ` [PATCH 3/3] mmc: usdhi6rol0: fix ack register write Rabin Vincent
2015-08-25 12:07 ` [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Ulf Hansson
2 siblings, 1 reply; 6+ messages in thread
From: Rabin Vincent @ 2015-08-19 13:41 UTC (permalink / raw)
To: ulf.hansson; +Cc: g.liakhovetski, linux-mmc, Rabin Vincent
host->sg is only set when we're transferring multiple blocks. Check for
its availibility before dereferencing it in the timeout work debug
print.
Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
drivers/mmc/host/usdhi6rol0.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 63d5d72..4188e84e 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1634,6 +1634,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work);
struct mmc_request *mrq = host->mrq;
struct mmc_data *data = mrq ? mrq->data : NULL;
+ struct scatterlist *sg = host->sg ?: data->sg;
dev_warn(mmc_dev(host->mmc),
"%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n",
@@ -1669,7 +1670,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
"%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n",
data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,
host->offset, data->blocks, data->blksz, data->sg_len,
- sg_dma_len(host->sg), host->sg->offset);
+ sg_dma_len(sg), sg->offset);
usdhi6_sg_unmap(host, true);
/*
* If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] mmc: usdhi6rol0: fix ack register write
2015-08-19 13:41 [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Rabin Vincent
2015-08-19 13:41 ` [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print Rabin Vincent
@ 2015-08-19 13:41 ` Rabin Vincent
2015-08-25 12:07 ` Ulf Hansson
2015-08-25 12:07 ` [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Ulf Hansson
2 siblings, 1 reply; 6+ messages in thread
From: Rabin Vincent @ 2015-08-19 13:41 UTC (permalink / raw)
To: ulf.hansson; +Cc: g.liakhovetski, linux-mmc, Rabin Vincent
The intent appears to be to clear only the bits which are set in status
(by setting them to zero in the ack write), like in the other interrupt
handlers, and not to always clear everything (by always writing zero).
Use the correct not operator.
Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
drivers/mmc/host/usdhi6rol0.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 4188e84e..b505cbc2 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1611,7 +1611,7 @@ static irqreturn_t usdhi6_cd(int irq, void *dev_id)
return IRQ_NONE;
/* Ack */
- usdhi6_write(host, USDHI6_SD_INFO1, !status);
+ usdhi6_write(host, USDHI6_SD_INFO1, ~status);
if (!work_pending(&mmc->detect.work) &&
(((status & USDHI6_SD_INFO1_CARD_INSERT) &&
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator
2015-08-19 13:41 [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Rabin Vincent
2015-08-19 13:41 ` [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print Rabin Vincent
2015-08-19 13:41 ` [PATCH 3/3] mmc: usdhi6rol0: fix ack register write Rabin Vincent
@ 2015-08-25 12:07 ` Ulf Hansson
2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-08-25 12:07 UTC (permalink / raw)
To: Rabin Vincent; +Cc: Guennadi Liakhovetski, linux-mmc, Rabin Vincent
On 19 August 2015 at 15:41, Rabin Vincent <rabin.vincent@axis.com> wrote:
> We ignore errors from mmc_regulator_get_supply() because the usage of
> the regulators is optional for the driver, but we still need to check
> for and handle EPROBE_DEFER, like it's done in for example dw_mmc.
> Otherwise we might end up not using the specified regulators just
> because of probe order.
>
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/usdhi6rol0.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
> index 54b082b..63d5d72 100644
> --- a/drivers/mmc/host/usdhi6rol0.c
> +++ b/drivers/mmc/host/usdhi6rol0.c
> @@ -1715,12 +1715,14 @@ static int usdhi6_probe(struct platform_device *pdev)
> if (!mmc)
> return -ENOMEM;
>
> + ret = mmc_regulator_get_supply(mmc);
> + if (ret == -EPROBE_DEFER)
> + goto e_free_mmc;
> +
> ret = mmc_of_parse(mmc);
> if (ret < 0)
> goto e_free_mmc;
>
> - mmc_regulator_get_supply(mmc);
> -
> host = mmc_priv(mmc);
> host->mmc = mmc;
> host->wait = USDHI6_WAIT_FOR_REQUEST;
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] mmc: usdhi6rol0: fix ack register write
2015-08-19 13:41 ` [PATCH 3/3] mmc: usdhi6rol0: fix ack register write Rabin Vincent
@ 2015-08-25 12:07 ` Ulf Hansson
0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-08-25 12:07 UTC (permalink / raw)
To: Rabin Vincent; +Cc: Guennadi Liakhovetski, linux-mmc, Rabin Vincent
On 19 August 2015 at 15:41, Rabin Vincent <rabin.vincent@axis.com> wrote:
> The intent appears to be to clear only the bits which are set in status
> (by setting them to zero in the ack write), like in the other interrupt
> handlers, and not to always clear everything (by always writing zero).
> Use the correct not operator.
>
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/usdhi6rol0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
> index 4188e84e..b505cbc2 100644
> --- a/drivers/mmc/host/usdhi6rol0.c
> +++ b/drivers/mmc/host/usdhi6rol0.c
> @@ -1611,7 +1611,7 @@ static irqreturn_t usdhi6_cd(int irq, void *dev_id)
> return IRQ_NONE;
>
> /* Ack */
> - usdhi6_write(host, USDHI6_SD_INFO1, !status);
> + usdhi6_write(host, USDHI6_SD_INFO1, ~status);
>
> if (!work_pending(&mmc->detect.work) &&
> (((status & USDHI6_SD_INFO1_CARD_INSERT) &&
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print
2015-08-19 13:41 ` [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print Rabin Vincent
@ 2015-08-25 12:07 ` Ulf Hansson
0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-08-25 12:07 UTC (permalink / raw)
To: Rabin Vincent; +Cc: Guennadi Liakhovetski, linux-mmc, Rabin Vincent
On 19 August 2015 at 15:41, Rabin Vincent <rabin.vincent@axis.com> wrote:
> host->sg is only set when we're transferring multiple blocks. Check for
> its availibility before dereferencing it in the timeout work debug
> print.
>
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/usdhi6rol0.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
> index 63d5d72..4188e84e 100644
> --- a/drivers/mmc/host/usdhi6rol0.c
> +++ b/drivers/mmc/host/usdhi6rol0.c
> @@ -1634,6 +1634,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
> struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work);
> struct mmc_request *mrq = host->mrq;
> struct mmc_data *data = mrq ? mrq->data : NULL;
> + struct scatterlist *sg = host->sg ?: data->sg;
>
> dev_warn(mmc_dev(host->mmc),
> "%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n",
> @@ -1669,7 +1670,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
> "%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n",
> data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,
> host->offset, data->blocks, data->blksz, data->sg_len,
> - sg_dma_len(host->sg), host->sg->offset);
> + sg_dma_len(sg), sg->offset);
> usdhi6_sg_unmap(host, true);
> /*
> * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-25 12:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 13:41 [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Rabin Vincent
2015-08-19 13:41 ` [PATCH 2/3] mmc: usdhi6rol0: fix NULL pointer deref in debug print Rabin Vincent
2015-08-25 12:07 ` Ulf Hansson
2015-08-19 13:41 ` [PATCH 3/3] mmc: usdhi6rol0: fix ack register write Rabin Vincent
2015-08-25 12:07 ` Ulf Hansson
2015-08-25 12:07 ` [PATCH 1/3] mmc: usdhi6rol0: handle probe deferral for regulator Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox