[PATCH 3/8] Staging: unisys: Remove FAIL_WPOSTCODE_1 macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Part of a series to get rid of goto statements embedded in macros.  I'm
breaking this up into a series of smaller patches for easier review.  The
later patches in the series will actually remove the goto statements.

Signed-off-by: Ken Cox <jkc@xxxxxxxxxx>
---
 drivers/staging/unisys/include/timskmod.h          |  7 ---
 .../unisys/visorchipset/visorchipset_main.c        | 50 ++++++++++++++--------
 2 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h
index 413a367..6abb32e 100644
--- a/drivers/staging/unisys/include/timskmod.h
+++ b/drivers/staging/unisys/include/timskmod.h
@@ -148,13 +148,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
 		       msg, status);				      \
 		RETINT(status);					      \
 	} while (0)
-#define FAIL_WPOSTCODE_1(msg, status, EVENT_PC) do {          \
-		ERRDRV("'%s'"					      \
-		       ": error (status=%d)\n",			      \
-		       msg, status);					\
-		POSTCODE_LINUX_2(EVENT_PC, DIAG_SEVERITY_ERR);		\
-		RETINT(status);						\
-	} while (0)
 /** Try to evaulate the provided expression, and do a RETINT(x) iff
  *  the expression evaluates to < 0.
  *  @param x the expression to try
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index b0f97db..b769257 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -2695,9 +2695,11 @@ visorchipset_init(void)
 	controlvm_init();
 	MajorDev = MKDEV(visorchipset_major, 0);
 	rc = visorchipset_file_init(MajorDev, &ControlVm_channel);
-	if (rc < 0)
-		FAIL_WPOSTCODE_1("visorchipset_file_init(MajorDev, &ControlVm_channel)",
-				 rc, CHIPSET_INIT_FAILURE_PC);
+	if (rc < 0) {
+		ERRDRV("visorchipset_file_init(MajorDev, &ControlVm_channel): error (status=%d)\n", rc);
+		POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR);
+		goto Away;
+	}
 
 	proc_Init();
 	memset(PartitionPropertyNames, 0, sizeof(PartitionPropertyNames));
@@ -2738,16 +2740,20 @@ visorchipset_init(void)
 	memset(&g_DelDumpMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER));
 
 	if (filexfer_constructor(sizeof(struct putfile_request)) < 0) {
-		FAIL_WPOSTCODE_1("filexfer_constructor failed", -1,
-				 CHIPSET_INIT_FAILURE_PC);
+		ERRDRV("filexfer_constructor failed: (status=-1)\n");
+		POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR);
+		rc = -1;
+		goto Away;
 	}
 	Putfile_buffer_list_pool =
 	    kmem_cache_create(Putfile_buffer_list_pool_name,
 			      sizeof(struct putfile_buffer_entry),
 			      0, SLAB_HWCACHE_ALIGN, NULL);
 	if (!Putfile_buffer_list_pool) {
-		FAIL_WPOSTCODE_1("failed to alloc Putfile_buffer_list_pool", -1,
-				 CHIPSET_INIT_FAILURE_PC);
+		ERRDRV("failed to alloc Putfile_buffer_list_pool: (status=-1)\n");
+		POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR);
+		rc = -1;
+		goto Away;
 	}
 	if (visorchipset_disable_controlvm) {
 		LOGINF("visorchipset_init:controlvm disabled");
@@ -2762,24 +2768,34 @@ visorchipset_init(void)
 		Periodic_controlvm_workqueue =
 		    create_singlethread_workqueue("visorchipset_controlvm");
 
-		if (Periodic_controlvm_workqueue == NULL)
-			FAIL_WPOSTCODE_1("cannot create controlvm workqueue",
-					 -ENOMEM, CREATE_WORKQUEUE_FAILED_PC);
+		if (Periodic_controlvm_workqueue == NULL) {
+			ERRDRV("cannot create controlvm workqueue: (status=%d)\n",
+			       -ENOMEM);
+			POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC,
+					 DIAG_SEVERITY_ERR);
+			rc = -ENOMEM;
+			goto Away;
+		}
 		Most_recent_message_jiffies = jiffies;
 		Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
 		rc = queue_delayed_work(Periodic_controlvm_workqueue,
 					&Periodic_controlvm_work, Poll_jiffies);
-		if (rc < 0)
-			FAIL_WPOSTCODE_1("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies);",
-					 rc, QUEUE_DELAYED_WORK_PC);
+		if (rc < 0) {
+			ERRDRV("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies): error (status=%d)\n", rc);
+			POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC,
+					 DIAG_SEVERITY_ERR);
+			goto Away;
+		}
 
 	}
 
 	Visorchipset_platform_device.dev.devt = MajorDev;
-	if (platform_device_register(&Visorchipset_platform_device) < 0)
-		FAIL_WPOSTCODE_1
-		    ("platform_device_register(visorchipset) failed", -1,
-		     DEVICE_REGISTER_FAILURE_PC);
+	if (platform_device_register(&Visorchipset_platform_device) < 0) {
+		ERRDRV("platform_device_register(visorchipset) failed: (status=-1)\n");
+		POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR);
+		rc = -1;
+		goto Away;
+	}
 	LOGINF("visorchipset device created");
 	POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO);
 	RETINT(0);
-- 
1.8.5.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux