diff mbox

[media] exynos-gsc: remove an always false condition

Message ID 26a7ed9c18193dc7a3dfba33e3c711822f4bdd29.1460575950.git.mchehab@osg.samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Mauro Carvalho Chehab April 13, 2016, 7:32 p.m. UTC
As reported by smatch:
drivers/media/platform/exynos-gsc/gsc-core.c:1073 gsc_probe() warn: impossible condition '(gsc->id < 0) => (0-65535 < 0)'
drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_probe':
drivers/media/platform/exynos-gsc/gsc-core.c:1073:51: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  if (gsc->id >= drv_data->num_entities || gsc->id < 0) {
                                                   ^

gsc->id is an u16, so it can never be a negative number. So,
remove the always false condition.

Fixes: c1ac057173ba "[media] exynos-gsc: remove non-device-tree init code"
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

On 04/13/2016 09:32 PM, Mauro Carvalho Chehab wrote:
> As reported by smatch:
> drivers/media/platform/exynos-gsc/gsc-core.c:1073 gsc_probe() warn: impossible condition '(gsc->id < 0) => (0-65535 < 0)'
> drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_probe':
> drivers/media/platform/exynos-gsc/gsc-core.c:1073:51: warning: comparison is always false due to limited range of data type [-Wtype-limits]
>   if (gsc->id >= drv_data->num_entities || gsc->id < 0) {
>                                                    ^
> 
> gsc->id is an u16, so it can never be a negative number. So,
> remove the always false condition.
> 
> Fixes: c1ac057173ba "[media] exynos-gsc: remove non-device-tree init code"
> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Thanks for fixing this.
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
diff mbox

Patch

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index 032a423fb892..c595723f5031 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1070,7 +1070,7 @@  static int gsc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	gsc->id = of_alias_get_id(pdev->dev.of_node, "gsc");
-	if (gsc->id >= drv_data->num_entities || gsc->id < 0) {
+	if (gsc->id >= drv_data->num_entities) {
 		dev_err(dev, "Invalid platform device id: %d\n", gsc->id);
 		return -EINVAL;
 	}