From: Jaehoon Chung <jh80.chung@samsung.com>
Date: Fri, 24 Sep 2021 00:23:34 +0000 (+0900)
Subject: cmd: mmc: check whether card is SD or eMMC before hwpartition
X-Git-Tag: v2025.01-rc5-pxa1908~1661^2~2
X-Git-Url: http://git.dujemihanovic.xyz/%22/icons/right.gif/static/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=0d453c84bae95174ca3bd94c72a46112580b24c8;p=u-boot.git

cmd: mmc: check whether card is SD or eMMC before hwpartition

It doesn't need to follow more sequence to do the hwparititioning,
because SD doesn't support hwpartitioning feature.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 64e6be7280..96d81ffdf3 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -698,6 +698,11 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag,
 	if (!mmc)
 		return CMD_RET_FAILURE;
 
+	if (IS_SD(mmc)) {
+		puts("SD doesn't support partitioning\n");
+		return CMD_RET_FAILURE;
+	}
+
 	if (argc < 1)
 		return CMD_RET_USAGE;
 	i = 1;