aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-04-26 05:15:38 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-05-09 17:38:33 -0400
commitaff093d4bbca91f543e24cde2135f393b8130f4b (patch)
treec3ce98c50fbd91a96b3d574e2e91d8fc1c789cf2
parent0185f850176201260e0f02c5bccca1defb8e0884 (diff)
[media] exynos-gsc: avoid build warning without CONFIG_OF
When building the exynos-gsc driver with CONFIG_OF disabled, we get a warning about an out-of-bounds access: drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_probe': drivers/media/platform/exynos-gsc/gsc-core.c:1078:34: error: array subscript is above array bounds [-Werror=array-bounds] This is harmless because the driver will never be used without CONFIG_OF, but it's better to avoid the warning anyway. Checking the return value of of_alias_get_id() for an error condition is probably a good idea anyway, and it makes sure the compiler can verify that we don't get into that situation. Fixes: 26a7ed9c1819 ("[media] exynos-gsc: remove an always false condition") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index c595723f5031..c04973669a47 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1063,13 +1063,17 @@ static int gsc_probe(struct platform_device *pdev)
1063 struct resource *res; 1063 struct resource *res;
1064 struct gsc_driverdata *drv_data = gsc_get_drv_data(pdev); 1064 struct gsc_driverdata *drv_data = gsc_get_drv_data(pdev);
1065 struct device *dev = &pdev->dev; 1065 struct device *dev = &pdev->dev;
1066 int ret = 0; 1066 int ret;
1067 1067
1068 gsc = devm_kzalloc(dev, sizeof(struct gsc_dev), GFP_KERNEL); 1068 gsc = devm_kzalloc(dev, sizeof(struct gsc_dev), GFP_KERNEL);
1069 if (!gsc) 1069 if (!gsc)
1070 return -ENOMEM; 1070 return -ENOMEM;
1071 1071
1072 gsc->id = of_alias_get_id(pdev->dev.of_node, "gsc"); 1072 ret = of_alias_get_id(pdev->dev.of_node, "gsc");
1073 if (ret < 0)
1074 return ret;
1075
1076 gsc->id = ret;
1073 if (gsc->id >= drv_data->num_entities) { 1077 if (gsc->id >= drv_data->num_entities) {
1074 dev_err(dev, "Invalid platform device id: %d\n", gsc->id); 1078 dev_err(dev, "Invalid platform device id: %d\n", gsc->id);
1075 return -EINVAL; 1079 return -EINVAL;