Commit 84672369 authored by Fernando Soto's avatar Fernando Soto Committed by Greg Kroah-Hartman

Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered

Whenever a device is unregistered in vmbus_device_unregister (drivers/hv/vmbus_drv.c), the device name in the log message may contain garbage as the memory has already been freed by the time pr_info is called. Log example:
 [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered

By logging the message just before calling device_unregister, the correct device name is printed:
[ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered

Also changing register & unregister messages to debug to avoid unnecessarily cluttering the kernel log.
Signed-off-by: default avatarFernando M Soto <fsoto@bluecatnetworks.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ad81f054
...@@ -690,7 +690,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) ...@@ -690,7 +690,7 @@ int vmbus_device_register(struct hv_device *child_device_obj)
if (ret) if (ret)
pr_err("Unable to register child device\n"); pr_err("Unable to register child device\n");
else else
pr_info("child device %s registered\n", pr_debug("child device %s registered\n",
dev_name(&child_device_obj->device)); dev_name(&child_device_obj->device));
return ret; return ret;
...@@ -702,14 +702,14 @@ int vmbus_device_register(struct hv_device *child_device_obj) ...@@ -702,14 +702,14 @@ int vmbus_device_register(struct hv_device *child_device_obj)
*/ */
void vmbus_device_unregister(struct hv_device *device_obj) void vmbus_device_unregister(struct hv_device *device_obj)
{ {
pr_debug("child device %s unregistered\n",
dev_name(&device_obj->device));
/* /*
* Kick off the process of unregistering the device. * Kick off the process of unregistering the device.
* This will call vmbus_remove() and eventually vmbus_device_release() * This will call vmbus_remove() and eventually vmbus_device_release()
*/ */
device_unregister(&device_obj->device); device_unregister(&device_obj->device);
pr_info("child device %s unregistered\n",
dev_name(&device_obj->device));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment