public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: hv: Fix null pointer error after vmbus loading
@ 2009-10-22 16:14 Haiyang Zhang
  2009-10-22 22:56 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Haiyang Zhang @ 2009-10-22 16:14 UTC (permalink / raw)
  To: gregkh@suse.de, Hank Janssen; +Cc: 'linux-kernel@vger.kernel.org'

From: Haiyang Zhang <haiyangz@microsoft.com>

Fix null pointer error after vmbus loading.

Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

---
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));


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] Staging: hv: Fix null pointer error after vmbus loading
@ 2009-10-23 18:14 Haiyang Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Haiyang Zhang @ 2009-10-23 18:14 UTC (permalink / raw)
  To: 'gregkh@suse.de', Hank Janssen
  Cc: 'linux-kernel@vger.kernel.org'

From: Haiyang Zhang <haiyangz@microsoft.com>

Fix null pointer error after vmbus loading. Remove code that checks for dev_name, the affected structure is kzalloc-ed prior to this routine, so it is always null at this stage.

Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

---
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 582318f..1c7f887 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -537,18 +537,7 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
 	DPRINT_DBG(VMBUS_DRV, "child device (%p) registering",
 		   child_device_ctx);
 
-	/* Make sure we are not registered already */
-	if (strlen(dev_name(&child_device_ctx->device)) != 0) {
-		DPRINT_ERR(VMBUS_DRV,
-			   "child device (%p) already registered - busid %s",
-			   child_device_ctx,
-			   dev_name(&child_device_ctx->device));
-
-		ret = -1;
-		goto Cleanup;
-	}
-
-	/* Set the device bus id. Otherwise, device_register()will fail. */
+	/* Set the device name. Otherwise, device_register()will fail. */
 	dev_set_name(&child_device_ctx->device, "vmbus_0_%d",
 		     atomic_inc_return(&device_num));
 
@@ -573,7 +562,6 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
 		DPRINT_INFO(VMBUS_DRV, "child device (%p) registered",
 			    &child_device_ctx->device);
 
-Cleanup:
 	DPRINT_EXIT(VMBUS_DRV);
 
 	return ret;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-23 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-22 16:14 [PATCH] Staging: hv: Fix null pointer error after vmbus loading Haiyang Zhang
2009-10-22 22:56 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2009-10-23 18:14 Haiyang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox