phy: exynos-mipi-video: fix check on array index
authorAntoine Ténart <antoine.tenart@free-electrons.com>
Mon, 12 May 2014 12:56:28 +0000 (14:56 +0200)
committerKishon Vijay Abraham I <kishon@ti.com>
Mon, 12 May 2014 13:32:02 +0000 (19:02 +0530)
The phys array is of size EXYNOS_MIPI_PHYS_NUM. Trying to access the
index EXYNOS_MIPI_PHYS_NUM should return an error.

Fixes: 069d2e26e9d6 "phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs"

Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/phy-exynos-mipi-video.c

index 7f139326a6424e8b38d5fdd9049f26d85e679e6c..ff026689358c592568920234d480545b2d3a776c 100644 (file)
@@ -101,7 +101,7 @@ static struct phy *exynos_mipi_video_phy_xlate(struct device *dev,
 {
        struct exynos_mipi_video_phy *state = dev_get_drvdata(dev);
 
-       if (WARN_ON(args->args[0] > EXYNOS_MIPI_PHYS_NUM))
+       if (WARN_ON(args->args[0] >= EXYNOS_MIPI_PHYS_NUM))
                return ERR_PTR(-ENODEV);
 
        return state->phys[args->args[0]].phy;