History

gpu: host1x: fix uninitialized variable use

The error handling for platform_get_irq() failing no longer works after a recent change, clang now points this out with a warning: drivers/gpu/host1x/dev.c:520:6: error: variable 'syncpt_irq' is uninitialized when used here [-Werror,-Wuninitialized] if (syncpt_irq < 0) ^~~~~~~~~~ Fix this by removing the variable and checking the correct error status.

Arnd Bergmann committed 3 years ago

Commit 08570b71 parent 2e4e9de1 file · +2 −3Browse files

Unified · Split

drivers/gpu/host1x/dev.c+2−3
@@ -487,7 +487,6 @@ static int host1x_get_resets(struct host1x *host) · 486 unmodified lines
487static int host1x_probe(struct platform_device *pdev)487static int host1x_probe(struct platform_device *pdev)
488{488{
489 struct host1x *host;489 struct host1x *host;
490 int syncpt_irq;
491 int err;490 int err;
492 491
493 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);492 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
@@ -517,8 +516,8 @@ static int host1x_probe(struct platform_device *pdev) · 23 unmodified lines
517 }516 }
518 517
519 host->syncpt_irq = platform_get_irq(pdev, 0);518 host->syncpt_irq = platform_get_irq(pdev, 0);
520 if (syncpt_irq < 0)519 if (host->syncpt_irq < 0)
521 return syncpt_irq;520 return host->syncpt_irq;
522 521
523 mutex_init(&host->devices_lock);522 mutex_init(&host->devices_lock);
524 INIT_LIST_HEAD(&host->devices);523 INIT_LIST_HEAD(&host->devices);