diff mbox

[1/2] mmc: renesas_sdhi_internal_dmac: Fix missing unmap in error patch

Message ID 1530181745-10519-2-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yoshihiro Shimoda June 28, 2018, 10:29 a.m. UTC
This patch fixes an issue that lacks the dma_unmap_sg() calling in
the error patch of renesas_sdhi_internal_dmac_start_dma().

Fixes: 0cbc94daa554 ("mmc: renesas_sdhi_internal_dmac: limit DMA RX for old SoCs")
Cc: <stable@vger.kernel.org> # v4.17+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven June 28, 2018, 12:50 p.m. UTC | #1
Hi Shimoda-san,

On Thu, Jun 28, 2018 at 1:53 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch fixes an issue that lacks the dma_unmap_sg() calling in
> the error patch of renesas_sdhi_internal_dmac_start_dma().

Nice catch!
Thanks for your patch!

> Fixes: 0cbc94daa554 ("mmc: renesas_sdhi_internal_dmac: limit DMA RX for old SoCs")
> Cc: <stable@vger.kernel.org> # v4.17+
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -173,8 +173,11 @@
>         if (data->flags & MMC_DATA_READ) {
>                 dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
>                 if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) &&
> -                   test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags))
> +                   test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags)) {
> +                       dma_unmap_sg(&host->pdev->dev, sg, host->sg_len,
> +                                    mmc_get_dma_dir(data));

Given there is already a call to dma_unmap_sg() a few lines earlier , you
may want to introduce a new label before force_pio, and move the call to
dma_unmap_sg() there.

>                         goto force_pio;
> +               }
>         } else {
>                 dtran_mode |= DTRAN_MODE_CH_NUM_CH0;
>         }

Gr{oetje,eeting}s,

                        Geert
Yoshihiro Shimoda June 29, 2018, 9:39 a.m. UTC | #2
SGkgR2VlcnQtc2FuLA0KDQo+IEZyb206IEdlZXJ0IFV5dHRlcmhvZXZlbiwgU2VudDogVGh1cnNk
YXksIEp1bmUgMjgsIDIwMTggOTo1MCBQTQ0KPiANCj4gSGkgU2hpbW9kYS1zYW4sDQo+IA0KPiBP
biBUaHUsIEp1biAyOCwgMjAxOCBhdCAxOjUzIFBNIFlvc2hpaGlybyBTaGltb2RhDQo+IDx5b3No
aWhpcm8uc2hpbW9kYS51aEByZW5lc2FzLmNvbT4gd3JvdGU6DQo+ID4gVGhpcyBwYXRjaCBmaXhl
cyBhbiBpc3N1ZSB0aGF0IGxhY2tzIHRoZSBkbWFfdW5tYXBfc2coKSBjYWxsaW5nIGluDQo+ID4g
dGhlIGVycm9yIHBhdGNoIG9mIHJlbmVzYXNfc2RoaV9pbnRlcm5hbF9kbWFjX3N0YXJ0X2RtYSgp
Lg0KPiANCj4gTmljZSBjYXRjaCENCj4gVGhhbmtzIGZvciB5b3VyIHBhdGNoIQ0KPiANCj4gPiBG
aXhlczogMGNiYzk0ZGFhNTU0ICgibW1jOiByZW5lc2FzX3NkaGlfaW50ZXJuYWxfZG1hYzogbGlt
aXQgRE1BIFJYIGZvciBvbGQgU29DcyIpDQo+ID4gQ2M6IDxzdGFibGVAdmdlci5rZXJuZWwub3Jn
PiAjIHY0LjE3Kw0KPiA+IFNpZ25lZC1vZmYtYnk6IFlvc2hpaGlybyBTaGltb2RhIDx5b3NoaWhp
cm8uc2hpbW9kYS51aEByZW5lc2FzLmNvbT4NCj4gDQo+IFJldmlld2VkLWJ5OiBHZ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Hlv
dQ0KPiBtYXkgd2FudCB0byBpbnRyb2R1Y2UgYSBuZXcgbGFiZWwgYmVmb3JlIGZvcmNlX3Bpbywg
YW5kIG1vdmUgdGhlIGNhbGwgdG8NCj4gZG1hX3VubWFwX3NnKCkgdGhlcmUuDQoNClRoYW5rIHlv
dSBmb3IgdGhlIGNvbW1lbnQuIFNvLCBJJ2xsIHN1Ym1pdCB2MiBwYXRjaC4NCg0KQmVzdCByZWdh
cmRzLA0KWW9zaGloaXJvIFNoaW1vZGENCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index f7f9773..d503511 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -173,8 +173,11 @@ 
 	if (data->flags & MMC_DATA_READ) {
 		dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
 		if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) &&
-		    test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags))
+		    test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags)) {
+			dma_unmap_sg(&host->pdev->dev, sg, host->sg_len,
+				     mmc_get_dma_dir(data));
 			goto force_pio;
+		}
 	} else {
 		dtran_mode |= DTRAN_MODE_CH_NUM_CH0;
 	}