driver core: Prevent warning when removing a device link from unregistered consumer
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 16 Jul 2021 11:44:07 +0000 (14:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jul 2021 15:28:42 +0000 (17:28 +0200)
commite64daad660a0c9ace3acdc57099fffe5ed83f977
tree249022dd106d11ae5b031ebf19361479e1b9ef22
parent4afa0c22eed33cfe0c590742387f0d16f32412f3
driver core: Prevent warning when removing a device link from unregistered consumer

sysfs_remove_link() causes a warning if the parent directory does not
exist. That can happen if the device link consumer has not been registered.
So do not attempt sysfs_remove_link() in that case.

Fixes: 287905e68dd29 ("driver core: Expose device link details in sysfs")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org # 5.9+
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20210716114408.17320-2-adrian.hunter@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c