driver core: platform: Drop redundant check in platform_device_add()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 3 Oct 2023 14:21:19 +0000 (17:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2023 09:12:59 +0000 (11:12 +0200)
Starting from the commit 37c12e7497b6 ("[DRIVER MODEL] Improved
dynamically allocated platform_device interface") the pdev expects
to be allocated beforehand or guaranteed to be non-NULL.

Hence the leftover check is now redundant (as we have no combined
calls like platform_device_add(platform_device_alloc(...)) in the
entire kernel source code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231003142122.3072824-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c

index 76bfcba250039f631e0fa53a2f67d00157383ee3..d81f05c4fccda8088e6c273b3957116433603f98 100644 (file)
@@ -658,9 +658,6 @@ int platform_device_add(struct platform_device *pdev)
        u32 i;
        int ret;
 
-       if (!pdev)
-               return -EINVAL;
-
        if (!pdev->dev.parent)
                pdev->dev.parent = &platform_bus;