Skip to content

Commit 25ebcb7

Browse files
andy-shevgregkh
authored andcommitted
driver core: platform: Propagate error from insert_resource()
Since insert_resource() might return an error we don't need to shadow its error code and would safely propagate to the user. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9982679 commit 25ebcb7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/base/platform.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,12 @@ int platform_device_add(struct platform_device *pdev)
438438
p = &ioport_resource;
439439
}
440440

441-
if (p && insert_resource(p, r)) {
442-
dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
443-
ret = -EBUSY;
444-
goto failed;
441+
if (p) {
442+
ret = insert_resource(p, r);
443+
if (ret) {
444+
dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
445+
goto failed;
446+
}
445447
}
446448
}
447449

0 commit comments

Comments
 (0)