Re: [U-Boot] [PATCH 3/5] mmc: exynos_dw_mmc: add the error control for checking index

2016-06-29 Thread Simon Glass
On 29 June 2016 at 03:46, Jaehoon Chung  wrote:
> PERIPH_ID_SDMMC4(131) is not continous value with PERIPH_ID_SDMMC0(75).
> If there is no 'index' property in fdt, then dev_index should be
> assigned to dev_id(Peripheral ID).
> At this time, dev_index should be "56". It means Exynos SoC has "56"
> numbers of DWMMC IP. To prevent this behavior, it needs to check the
> maximum device index.
>
> Signed-off-by: Jaehoon Chung 
> ---
>  drivers/mmc/exynos_dw_mmc.c | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] mmc: exynos_dw_mmc: add the error control for checking index

2016-06-29 Thread Jaehoon Chung
PERIPH_ID_SDMMC4(131) is not continous value with PERIPH_ID_SDMMC0(75).
If there is no 'index' property in fdt, then dev_index should be
assigned to dev_id(Peripheral ID).
At this time, dev_index should be "56". It means Exynos SoC has "56"
numbers of DWMMC IP. To prevent this behavior, it needs to check the
maximum device index.

Signed-off-by: Jaehoon Chung 
---
 drivers/mmc/exynos_dw_mmc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 80d17ad..5860023 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -160,6 +160,11 @@ static int exynos_dwmci_get_config(const void *blob, int 
node,
if (host->dev_index == host->dev_id)
host->dev_index = host->dev_id - PERIPH_ID_SDMMC0;
 
+   if (host->dev_index > 4) {
+   printf("DWMMC%d: Can't get the dev index\n", host->dev_index);
+   return -EINVAL;
+   }
+
/* Get the bus width from the device node */
host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
if (host->buswidth <= 0) {
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot