Skip to content

Commit aab8aa0

Browse files
andy-shevgregkh
authored andcommitted
driver core: platform: Drop redundant check in platform_device_add()
Starting from the commit 37c12e7 ("[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>
1 parent 8a749fd commit aab8aa0

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

drivers/base/platform.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,6 @@ int platform_device_add(struct platform_device *pdev)
658658
u32 i;
659659
int ret;
660660

661-
if (!pdev)
662-
return -EINVAL;
663-
664661
if (!pdev->dev.parent)
665662
pdev->dev.parent = &platform_bus;
666663

0 commit comments

Comments
 (0)