Skip to contentSkip to conversation

mmc: sunxi: Fix NULL pointer reference on clk_delays

PATCH New Chen-Yu Tsai 3 participants 5 messages Aug 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: sunxi: Fix NULL pointer reference on clk_delays

Some SoCs do not support clk delays for MMC in the clock control unit. These include the old controllers in A10/A10s/A13/R8, and the new eMMC controller in A64. The config structure for these controllers do not specify clk_delays, but the check for this was replaced in commit b0600daebf31 ("mmc: sunxi: Support controllers that can use both old and new timings").

This patch adds back the check for clk_delays, and also adds comments for both checks in sunxi_mmc_clk_set_phase().

Fixes b0600daebf31 ("mmc: sunxi: Support controllers that can use

both old and new timings")

---
This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced by the A83T mmc patches.

v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64 EMMC (MMC2) controller"

Changes since v1:

- Polished comments

I've tested this on my A10 Cubieboard and A20 Cubieboard2.

---
 drivers/mmc/host/sunxi-mmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sunxi-mmc.c +5 -0
index 3777517982dd..9dc6d726ec49 100644
@@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
 {
 	int index;
 
+	/* clk controller delays not used under new timings mode */
 	if (host->use_new_timings)
 		return 0;
 
+	/* some old controllers don't support delays */
+	if (!host->cfg->clk_delays)
+		return 0;
+
 	/* determine delays */
 	if (rate <= 400000) {
 		index = SDXC_CLK_400K;
Signature · 1 line
2.13.3
#1 lore raw

PATCH v2 1/1 mmc: sunxi: Fix NULL pointer reference on clk_delays

? 2017-08-08 15:02?Chen-Yu Tsai ???

Quoted 7 lines

Some SoCs do not support clk delays for MMC in the clock control unit. These include the old controllers in A10/A10s/A13/R8, and the new eMMC controller in A64. The config structure for these controllers do not specify clk_delays, but the check for this was replaced in commit b0600daebf31 ("mmc: sunxi: Support controllers that can use both old and new timings").

Quoted 6 lines

This patch adds back the check for clk_delays, and also adds comments for both checks in sunxi_mmc_clk_set_phase().

Fixes b0600daebf31 ("mmc: sunxi: Support controllers that can use

both old and new timings")

Should I add a Tested-by here?

Quoted 37 lines

---
This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced by the A83T mmc patches.

v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64 EMMC (MMC2) controller"

Changes since v1:

- Polished comments

I've tested this on my A10 Cubieboard and A20 Cubieboard2.

---
 drivers/mmc/host/sunxi-mmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sunxi-mmc.c +5 -0
index 3777517982dd..9dc6d726ec49 100644
@@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct
 sunxi_mmc_host *host,
 {
 	int index;
 
+	/* clk controller delays not used under new timings mode */
 	if (host->use_new_timings)
 		return 0;
 
+	/* some old controllers don't support delays */
+	if (!host->cfg->clk_delays)
+		return 0;
+
 	/* determine delays */
 	if (rate <= 400000) {

index = SDXC_CLK_400K;

#2 lore raw
Quoted 12 lines · On Tue, Aug 8, 2017 at 3:07 PM, <[email protected]> wrote:

? 2017-08-08 15:02?Chen-Yu Tsai ???

Quoted 11 lines

Some SoCs do not support clk delays for MMC in the clock control unit. These include the old controllers in A10/A10s/A13/R8, and the new eMMC controller in A64. The config structure for these controllers do not specify clk_delays, but the check for this was replaced in commit b0600daebf31 ("mmc: sunxi: Support controllers that can use both old and new timings").

This patch adds back the check for clk_delays, and also adds comments for both checks in sunxi_mmc_clk_set_phase().

Quoted 6 lines
Quoted 3 lines
Fixes b0600daebf31 ("mmc: sunxi: Support controllers that can use

both old and new timings")

Should I add a Tested-by here?

If you tested it, then yes. :)

ChenYu

#3 lore raw

? 2017-08-08 15:10?Chen-Yu Tsai ???

Quoted 15 lines · On Tue, Aug 8, 2017 at 3:07 PM, <[email protected]> wrote:
Quoted 14 lines

? 2017-08-08 15:02?Chen-Yu Tsai ???

Quoted 13 lines

Some SoCs do not support clk delays for MMC in the clock control unit.
These include the old controllers in A10/A10s/A13/R8, and the new eMMC
controller in A64. The config structure for these controllers do not specify clk_delays, but the check for this was replaced in commit b0600daebf31 ("mmc: sunxi: Support controllers that can use both old and new timings").

This patch adds back the check for clk_delays, and also adds comments for both checks in sunxi_mmc_clk_set_phase().

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Fixes b0600daebf31 ("mmc: sunxi: Support controllers that can use

both old and new timings")

Should I add a Tested-by here?

If you tested it, then yes. :)

I tested it on A64 MMC2.

So:

Quoted 2 lines

ChenYu

Applied
#4 lore raw

PATCH v2 1/1 mmc: sunxi: Fix NULL pointer reference on clk_delays

In reply to Chen-Yu Tsai
Quoted 7 lines · Chen-Yu Tsai

Some SoCs do not support clk delays for MMC in the clock control unit. These include the old controllers in A10/A10s/A13/R8, and the new eMMC controller in A64. The config structure for these controllers do not specify clk_delays, but the check for this was replaced in commit b0600daebf31 ("mmc: sunxi: Support controllers that can use both old and new timings").

Quoted 6 lines

This patch adds back the check for clk_delays, and also adds comments for both checks in sunxi_mmc_clk_set_phase().

Fixes b0600daebf31 ("mmc: sunxi: Support controllers that can use

both old and new timings")

Thanks, applied for next!

Kind regards
Uffe

Quoted 38 lines

---
This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced by the A83T mmc patches.

v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64 EMMC (MMC2) controller"

Changes since v1:

- Polished comments

I've tested this on my A10 Cubieboard and A20 Cubieboard2.

---
 drivers/mmc/host/sunxi-mmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sunxi-mmc.c +5 -1
index 3777517982dd..9dc6d726ec49 100644
@@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
 {
        int index;
 
+       /* clk controller delays not used under new timings mode */
        if (host->use_new_timings)
                return 0;
 
+       /* some old controllers don't support delays */
+       if (!host->cfg->clk_delays)
+               return 0;
+
        /* determine delays */
        if (rate <= 400000) {
                index = SDXC_CLK_400K;
--

2.13.3