* [PATCH v1] driver core: platform: Respect return code of platform_device_register_full()
@ 2018-12-03 18:04 Andy Shevchenko
0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2018-12-03 18:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel,
Pierre-Louis Bossart
Cc: Andy Shevchenko
The platform_device_register_full() might return an error pointer. If we
instantiate platform device which is optional we may simplify the routine at
removal stage by simply calling platform_device_unregister(). For now it
requires to check parameter for being an error pointer in each caller.
To make users' life easier, check for an error pointer inside driver core.
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 41b91af95afb..e1ba610482c0 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -234,7 +234,7 @@ struct platform_object {
*/
void platform_device_put(struct platform_device *pdev)
{
- if (pdev)
+ if (!IS_ERR_OR_NULL(pdev))
put_device(&pdev->dev);
}
EXPORT_SYMBOL_GPL(platform_device_put);
@@ -447,7 +447,7 @@ void platform_device_del(struct platform_device *pdev)
{
int i;
- if (pdev) {
+ if (!IS_ERR_OR_NULL(pdev)) {
device_remove_properties(&pdev->dev);
device_del(&pdev->dev);
--
2.19.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-03 18:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 18:04 [PATCH v1] driver core: platform: Respect return code of platform_device_register_full() Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®