[PATCH] Staging: hv: Fix null pointer error after vmbus loading

From: Haiyang Zhang
Date: Thu Oct 22 2009 - 12:14:43 EST


From: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>

Fix null pointer error after vmbus loading.

Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Signed-off-by: Hank Janssen <hjanssen@xxxxxxxxxxxxx>
Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>

---
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 582318f..11431cc 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -538,9 +538,10 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
child_device_ctx);

/* Make sure we are not registered already */
- if (strlen(dev_name(&child_device_ctx->device)) != 0) {
+ if (dev_name(&child_device_ctx->device) != NULL &&
+ strlen(dev_name(&child_device_ctx->device)) != 0) {
DPRINT_ERR(VMBUS_DRV,
- "child device (%p) already registered - busid %s",
+ "child device (%p) already registered - device name: %s",
child_device_ctx,
dev_name(&child_device_ctx->device));

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/