aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/rmgr
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/tidspbridge/rmgr')
-rw-r--r--drivers/staging/tidspbridge/rmgr/dbdcd.c24
-rw-r--r--drivers/staging/tidspbridge/rmgr/disp.c28
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv.c8
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv_interface.c8
-rw-r--r--drivers/staging/tidspbridge/rmgr/dspdrv.c8
-rw-r--r--drivers/staging/tidspbridge/rmgr/mgr.c12
-rw-r--r--drivers/staging/tidspbridge/rmgr/nldr.c15
-rw-r--r--drivers/staging/tidspbridge/rmgr/node.c75
-rw-r--r--drivers/staging/tidspbridge/rmgr/proc.c42
-rw-r--r--drivers/staging/tidspbridge/rmgr/pwr.c8
-rw-r--r--drivers/staging/tidspbridge/rmgr/rmm.c4
-rw-r--r--drivers/staging/tidspbridge/rmgr/strm.c29
12 files changed, 129 insertions, 132 deletions
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 12d2d411b5a..f71e8606f95 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -135,7 +135,7 @@ int dcd_create_manager(char *sz_zl_dll_name,
135 DBC_REQUIRE(dcd_mgr); 135 DBC_REQUIRE(dcd_mgr);
136 136
137 status = cod_create(&cod_mgr, sz_zl_dll_name, NULL); 137 status = cod_create(&cod_mgr, sz_zl_dll_name, NULL);
138 if (DSP_FAILED(status)) 138 if (status)
139 goto func_end; 139 goto func_end;
140 140
141 /* Create a DCD object. */ 141 /* Create a DCD object. */
@@ -464,7 +464,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
464 /* Open COFF file. */ 464 /* Open COFF file. */
465 status = cod_open(dcd_mgr_obj->cod_mgr, dcd_key->path, 465 status = cod_open(dcd_mgr_obj->cod_mgr, dcd_key->path,
466 COD_NOLOAD, &lib); 466 COD_NOLOAD, &lib);
467 if (DSP_FAILED(status)) { 467 if (status) {
468 status = -EACCES; 468 status = -EACCES;
469 goto func_end; 469 goto func_end;
470 } 470 }
@@ -480,7 +480,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
480 480
481 /* Get section information. */ 481 /* Get section information. */
482 status = cod_get_section(lib, sz_sect_name, &ul_addr, &ul_len); 482 status = cod_get_section(lib, sz_sect_name, &ul_addr, &ul_len);
483 if (DSP_FAILED(status)) { 483 if (status) {
484 status = -EACCES; 484 status = -EACCES;
485 goto func_end; 485 goto func_end;
486 } 486 }
@@ -513,7 +513,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
513 /* Parse the content of the COFF buffer. */ 513 /* Parse the content of the COFF buffer. */
514 status = 514 status =
515 get_attrs_from_buf(psz_coff_buf, ul_len, obj_type, obj_def); 515 get_attrs_from_buf(psz_coff_buf, ul_len, obj_type, obj_def);
516 if (DSP_FAILED(status)) 516 if (status)
517 status = -EACCES; 517 status = -EACCES;
518 } else { 518 } else {
519 status = -EACCES; 519 status = -EACCES;
@@ -557,14 +557,14 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
557 557
558 /* Open DSP coff file, don't load symbols. */ 558 /* Open DSP coff file, don't load symbols. */
559 status = cod_open(dcd_mgr_obj->cod_mgr, sz_coff_path, COD_NOLOAD, &lib); 559 status = cod_open(dcd_mgr_obj->cod_mgr, sz_coff_path, COD_NOLOAD, &lib);
560 if (DSP_FAILED(status)) { 560 if (status) {
561 status = -EACCES; 561 status = -EACCES;
562 goto func_cont; 562 goto func_cont;
563 } 563 }
564 564
565 /* Get DCD_RESIGER_SECTION section information. */ 565 /* Get DCD_RESIGER_SECTION section information. */
566 status = cod_get_section(lib, DCD_REGISTER_SECTION, &ul_addr, &ul_len); 566 status = cod_get_section(lib, DCD_REGISTER_SECTION, &ul_addr, &ul_len);
567 if (DSP_FAILED(status) || !(ul_len > 0)) { 567 if (status || !(ul_len > 0)) {
568 status = -EACCES; 568 status = -EACCES;
569 goto func_cont; 569 goto func_cont;
570 } 570 }
@@ -617,7 +617,7 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
617 */ 617 */
618 status = 618 status =
619 register_fxn(&dsp_uuid_obj, object_type, handle); 619 register_fxn(&dsp_uuid_obj, object_type, handle);
620 if (DSP_FAILED(status)) { 620 if (status) {
621 /* if error occurs, break from while loop. */ 621 /* if error occurs, break from while loop. */
622 break; 622 break;
623 } 623 }
@@ -729,7 +729,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
729 status = -ENOKEY; 729 status = -ENOKEY;
730 730
731 /* If can't find, phases might be registered as generic LIBRARYTYPE */ 731 /* If can't find, phases might be registered as generic LIBRARYTYPE */
732 if (DSP_FAILED(status) && phase != NLDR_NOPHASE) { 732 if (status && phase != NLDR_NOPHASE) {
733 if (phase_split) 733 if (phase_split)
734 *phase_split = false; 734 *phase_split = false;
735 735
@@ -872,7 +872,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
872 status = -EPERM; 872 status = -EPERM;
873 } 873 }
874 874
875 if (DSP_FAILED(status)) 875 if (status)
876 goto func_end; 876 goto func_end;
877 877
878 /* 878 /*
@@ -1449,14 +1449,14 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
1449 /* Get dependent library section information. */ 1449 /* Get dependent library section information. */
1450 status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len); 1450 status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len);
1451 1451
1452 if (DSP_FAILED(status)) { 1452 if (status) {
1453 /* Ok, no dependent libraries */ 1453 /* Ok, no dependent libraries */
1454 ul_len = 0; 1454 ul_len = 0;
1455 status = 0; 1455 status = 0;
1456 } 1456 }
1457 } 1457 }
1458 1458
1459 if (DSP_FAILED(status) || !(ul_len > 0)) 1459 if (status || !(ul_len > 0))
1460 goto func_cont; 1460 goto func_cont;
1461 1461
1462 /* Allocate zeroed buffer. */ 1462 /* Allocate zeroed buffer. */
@@ -1466,7 +1466,7 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
1466 1466
1467 /* Read section contents. */ 1467 /* Read section contents. */
1468 status = cod_read_section(lib, DEPLIBSECT, psz_coff_buf, ul_len); 1468 status = cod_read_section(lib, DEPLIBSECT, psz_coff_buf, ul_len);
1469 if (DSP_FAILED(status)) 1469 if (status)
1470 goto func_cont; 1470 goto func_cont;
1471 1471
1472 /* Compress and format DSP buffer to conform to PC format. */ 1472 /* Compress and format DSP buffer to conform to PC format. */
diff --git a/drivers/staging/tidspbridge/rmgr/disp.c b/drivers/staging/tidspbridge/rmgr/disp.c
index 2d479b226c7..b7ce4353e06 100644
--- a/drivers/staging/tidspbridge/rmgr/disp.c
+++ b/drivers/staging/tidspbridge/rmgr/disp.c
@@ -121,12 +121,12 @@ int disp_create(struct disp_object **dispatch_obj,
121 121
122 /* check device type and decide if streams or messag'ing is used for 122 /* check device type and decide if streams or messag'ing is used for
123 * RMS/EDS */ 123 * RMS/EDS */
124 if (DSP_FAILED(status)) 124 if (status)
125 goto func_cont; 125 goto func_cont;
126 126
127 status = dev_get_dev_type(hdev_obj, &dev_type); 127 status = dev_get_dev_type(hdev_obj, &dev_type);
128 128
129 if (DSP_FAILED(status)) 129 if (status)
130 goto func_cont; 130 goto func_cont;
131 131
132 if (dev_type != DSP_UNIT) { 132 if (dev_type != DSP_UNIT) {
@@ -168,7 +168,7 @@ func_cont:
168 else 168 else
169 delete_disp(disp_obj); 169 delete_disp(disp_obj);
170 170
171 DBC_ENSURE(((DSP_FAILED(status)) && ((*dispatch_obj == NULL))) || 171 DBC_ENSURE((status && *dispatch_obj == NULL) ||
172 (!status && *dispatch_obj)); 172 (!status && *dispatch_obj));
173 return status; 173 return status;
174} 174}
@@ -284,7 +284,7 @@ int disp_node_create(struct disp_object *disp_obj,
284 284
285 status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type); 285 status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);
286 286
287 if (DSP_FAILED(status)) 287 if (status)
288 goto func_end; 288 goto func_end;
289 289
290 if (dev_type != DSP_UNIT) { 290 if (dev_type != DSP_UNIT) {
@@ -377,7 +377,7 @@ int disp_node_create(struct disp_object *disp_obj,
377 node_msg_args.arg_length); 377 node_msg_args.arg_length);
378 total += dw_length; 378 total += dw_length;
379 } 379 }
380 if (DSP_FAILED(status)) 380 if (status)
381 goto func_end; 381 goto func_end;
382 382
383 /* If node is a task node, copy task create arguments into buffer */ 383 /* If node is a task node, copy task create arguments into buffer */
@@ -425,7 +425,7 @@ int disp_node_create(struct disp_object *disp_obj,
425 /* Fill SIO defs and offsets */ 425 /* Fill SIO defs and offsets */
426 offset = sio_defs_offset; 426 offset = sio_defs_offset;
427 for (i = 0; i < task_arg_obj.num_inputs; i++) { 427 for (i = 0; i < task_arg_obj.num_inputs; i++) {
428 if (DSP_FAILED(status)) 428 if (status)
429 break; 429 break;
430 430
431 pdw_buf[sio_in_def_offset + i] = 431 pdw_buf[sio_in_def_offset + i] =
@@ -467,7 +467,7 @@ int disp_node_create(struct disp_object *disp_obj,
467 * on the DSP-side 467 * on the DSP-side
468 */ 468 */
469 status = (((rms_word *) (disp_obj->pbuf))[0]); 469 status = (((rms_word *) (disp_obj->pbuf))[0]);
470 if (DSP_FAILED(status)) 470 if (status < 0)
471 dev_dbg(bridge, "%s: DSP-side failed: 0x%x\n", 471 dev_dbg(bridge, "%s: DSP-side failed: 0x%x\n",
472 __func__, status); 472 __func__, status);
473 } 473 }
@@ -520,7 +520,7 @@ int disp_node_delete(struct disp_object *disp_obj,
520 * function on the DSP-side 520 * function on the DSP-side
521 */ 521 */
522 status = (((rms_word *) (disp_obj->pbuf))[0]); 522 status = (((rms_word *) (disp_obj->pbuf))[0]);
523 if (DSP_FAILED(status)) 523 if (status < 0)
524 dev_dbg(bridge, "%s: DSP-side failed: " 524 dev_dbg(bridge, "%s: DSP-side failed: "
525 "0x%x\n", __func__, status); 525 "0x%x\n", __func__, status);
526 } 526 }
@@ -573,7 +573,7 @@ int disp_node_run(struct disp_object *disp_obj,
573 * function on the DSP-side 573 * function on the DSP-side
574 */ 574 */
575 status = (((rms_word *) (disp_obj->pbuf))[0]); 575 status = (((rms_word *) (disp_obj->pbuf))[0]);
576 if (DSP_FAILED(status)) 576 if (status < 0)
577 dev_dbg(bridge, "%s: DSP-side failed: " 577 dev_dbg(bridge, "%s: DSP-side failed: "
578 "0x%x\n", __func__, status); 578 "0x%x\n", __func__, status);
579 } 579 }
@@ -603,7 +603,7 @@ static void delete_disp(struct disp_object *disp_obj)
603 * is invalid. */ 603 * is invalid. */
604 status = (*intf_fxns->pfn_chnl_close) 604 status = (*intf_fxns->pfn_chnl_close)
605 (disp_obj->chnl_from_dsp); 605 (disp_obj->chnl_from_dsp);
606 if (DSP_FAILED(status)) { 606 if (status) {
607 dev_dbg(bridge, "%s: Failed to close channel " 607 dev_dbg(bridge, "%s: Failed to close channel "
608 "from RMS: 0x%x\n", __func__, status); 608 "from RMS: 0x%x\n", __func__, status);
609 } 609 }
@@ -612,7 +612,7 @@ static void delete_disp(struct disp_object *disp_obj)
612 status = 612 status =
613 (*intf_fxns->pfn_chnl_close) (disp_obj-> 613 (*intf_fxns->pfn_chnl_close) (disp_obj->
614 chnl_to_dsp); 614 chnl_to_dsp);
615 if (DSP_FAILED(status)) { 615 if (status) {
616 dev_dbg(bridge, "%s: Failed to close channel to" 616 dev_dbg(bridge, "%s: Failed to close channel to"
617 " RMS: 0x%x\n", __func__, status); 617 " RMS: 0x%x\n", __func__, status);
618 } 618 }
@@ -704,7 +704,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
704 /* Send the command */ 704 /* Send the command */
705 status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes, 0, 705 status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes, 0,
706 0L, dw_arg); 706 0L, dw_arg);
707 if (DSP_FAILED(status)) 707 if (status)
708 goto func_end; 708 goto func_end;
709 709
710 status = 710 status =
@@ -718,14 +718,14 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
718 } 718 }
719 } 719 }
720 /* Get the reply */ 720 /* Get the reply */
721 if (DSP_FAILED(status)) 721 if (status)
722 goto func_end; 722 goto func_end;
723 723
724 chnl_obj = disp_obj->chnl_from_dsp; 724 chnl_obj = disp_obj->chnl_from_dsp;
725 ul_bytes = REPLYSIZE; 725 ul_bytes = REPLYSIZE;
726 status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes, 726 status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes,
727 0, 0L, dw_arg); 727 0, 0L, dw_arg);
728 if (DSP_FAILED(status)) 728 if (status)
729 goto func_end; 729 goto func_end;
730 730
731 status = 731 status =
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index 93e936943a8..12c270aa7ac 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -180,7 +180,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
180 list_for_each_entry_safe(map_obj, temp_map, &ctxt->dmm_map_list, link) { 180 list_for_each_entry_safe(map_obj, temp_map, &ctxt->dmm_map_list, link) {
181 status = proc_un_map(ctxt->hprocessor, 181 status = proc_un_map(ctxt->hprocessor,
182 (void *)map_obj->dsp_addr, ctxt); 182 (void *)map_obj->dsp_addr, ctxt);
183 if (DSP_FAILED(status)) 183 if (status)
184 pr_err("%s: proc_un_map failed!" 184 pr_err("%s: proc_un_map failed!"
185 " status = 0x%xn", __func__, status); 185 " status = 0x%xn", __func__, status);
186 } 186 }
@@ -190,7 +190,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
190 status = proc_un_reserve_memory(ctxt->hprocessor, (void *) 190 status = proc_un_reserve_memory(ctxt->hprocessor, (void *)
191 rsv_obj->dsp_reserved_addr, 191 rsv_obj->dsp_reserved_addr,
192 ctxt); 192 ctxt);
193 if (DSP_FAILED(status)) 193 if (status)
194 pr_err("%s: proc_un_reserve_memory failed!" 194 pr_err("%s: proc_un_reserve_memory failed!"
195 " status = 0x%xn", __func__, status); 195 " status = 0x%xn", __func__, status);
196 } 196 }
@@ -464,7 +464,7 @@ int drv_create(struct drv_object **drv_obj)
464 kfree(pdrv_object); 464 kfree(pdrv_object);
465 } 465 }
466 466
467 DBC_ENSURE(DSP_FAILED(status) || pdrv_object); 467 DBC_ENSURE(status || pdrv_object);
468 return status; 468 return status;
469} 469}
470 470
@@ -767,7 +767,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
767 767
768 DBC_ENSURE((!status && dev_node_strg != NULL && 768 DBC_ENSURE((!status && dev_node_strg != NULL &&
769 !LST_IS_EMPTY(pdrv_object->dev_node_string)) || 769 !LST_IS_EMPTY(pdrv_object->dev_node_string)) ||
770 (DSP_FAILED(status) && *dev_node_strg == 0)); 770 (status && *dev_node_strg == 0));
771 771
772 return status; 772 return status;
773} 773}
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index b1dcf4a56a5..aec7cf7d0d5 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -201,7 +201,7 @@ static void bridge_recover(struct work_struct *work)
201 } 201 }
202 dev = dev_get_first(); 202 dev = dev_get_first();
203 dev_get_dev_node(dev, &dev_node); 203 dev_get_dev_node(dev, &dev_node);
204 if (!dev_node || DSP_FAILED(proc_auto_start(dev_node, dev))) 204 if (!dev_node || proc_auto_start(dev_node, dev))
205 pr_err("DSP could not be restarted\n"); 205 pr_err("DSP could not be restarted\n");
206 recover = false; 206 recover = false;
207 complete_all(&bridge_open_comp); 207 complete_all(&bridge_open_comp);
@@ -397,7 +397,7 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
397 void *hdrv_obj = NULL; 397 void *hdrv_obj = NULL;
398 398
399 status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT); 399 status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
400 if (DSP_FAILED(status)) 400 if (status)
401 goto func_cont; 401 goto func_cont;
402 402
403#ifdef CONFIG_TIDSPBRIDGE_DVFS 403#ifdef CONFIG_TIDSPBRIDGE_DVFS
@@ -439,7 +439,7 @@ static int BRIDGE_SUSPEND(struct platform_device *pdev, pm_message_t state)
439 u32 command = PWR_EMERGENCYDEEPSLEEP; 439 u32 command = PWR_EMERGENCYDEEPSLEEP;
440 440
441 status = pwr_sleep_dsp(command, time_out); 441 status = pwr_sleep_dsp(command, time_out);
442 if (DSP_FAILED(status)) 442 if (status)
443 return -1; 443 return -1;
444 444
445 bridge_suspend_data.suspended = 1; 445 bridge_suspend_data.suspended = 1;
@@ -451,7 +451,7 @@ static int BRIDGE_RESUME(struct platform_device *pdev)
451 u32 status; 451 u32 status;
452 452
453 status = pwr_wake_dsp(time_out); 453 status = pwr_wake_dsp(time_out);
454 if (DSP_FAILED(status)) 454 if (status)
455 return -1; 455 return -1;
456 456
457 bridge_suspend_data.suspended = 0; 457 bridge_suspend_data.suspended = 0;
diff --git a/drivers/staging/tidspbridge/rmgr/dspdrv.c b/drivers/staging/tidspbridge/rmgr/dspdrv.c
index 0a10d886e2e..714f348f526 100644
--- a/drivers/staging/tidspbridge/rmgr/dspdrv.c
+++ b/drivers/staging/tidspbridge/rmgr/dspdrv.c
@@ -56,7 +56,7 @@ u32 dsp_init(u32 *init_status)
56 goto func_cont; 56 goto func_cont;
57 57
58 status = drv_create(&drv_obj); 58 status = drv_create(&drv_obj);
59 if (DSP_FAILED(status)) { 59 if (status) {
60 api_exit(); 60 api_exit();
61 goto func_cont; 61 goto func_cont;
62 } 62 }
@@ -68,7 +68,7 @@ u32 dsp_init(u32 *init_status)
68 /* Attempt to Start the Device */ 68 /* Attempt to Start the Device */
69 status = dev_start_device((struct cfg_devnode *) 69 status = dev_start_device((struct cfg_devnode *)
70 device_node_string); 70 device_node_string);
71 if (DSP_FAILED(status)) 71 if (status)
72 (void)drv_release_resources 72 (void)drv_release_resources
73 ((u32) device_node_string, drv_obj); 73 ((u32) device_node_string, drv_obj);
74 } else { 74 } else {
@@ -77,7 +77,7 @@ u32 dsp_init(u32 *init_status)
77 } 77 }
78 78
79 /* Unwind whatever was loaded */ 79 /* Unwind whatever was loaded */
80 if (DSP_FAILED(status)) { 80 if (status) {
81 /* irrespective of the status of dev_remove_device we conitinue 81 /* irrespective of the status of dev_remove_device we conitinue
82 * unloading. Get the Driver Object iterate through and remove. 82 * unloading. Get the Driver Object iterate through and remove.
83 * Reset the status to E_FAIL to avoid going through 83 * Reset the status to E_FAIL to avoid going through
@@ -106,7 +106,7 @@ func_cont:
106 dev_dbg(bridge, "%s: Failed\n", __func__); 106 dev_dbg(bridge, "%s: Failed\n", __func__);
107 } /* End api_init_complete2 */ 107 } /* End api_init_complete2 */
108 DBC_ENSURE((!status && drv_obj != NULL) || 108 DBC_ENSURE((!status && drv_obj != NULL) ||
109 (DSP_FAILED(status) && drv_obj == NULL)); 109 (status && drv_obj == NULL));
110 *init_status = status; 110 *init_status = status;
111 /* Return the Driver Object */ 111 /* Return the Driver Object */
112 return (u32) drv_obj; 112 return (u32) drv_obj;
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index 57ae8077a7f..57a39b9c274 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -82,7 +82,7 @@ int mgr_create(struct mgr_object **mgr_obj,
82 status = -ENOMEM; 82 status = -ENOMEM;
83 } 83 }
84 84
85 DBC_ENSURE(DSP_FAILED(status) || pmgr_obj); 85 DBC_ENSURE(status || pmgr_obj);
86 return status; 86 return status;
87} 87}
88 88
@@ -132,7 +132,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
132 *pu_num_nodes = 0; 132 *pu_num_nodes = 0;
133 /* Get The Manager Object from the Registry */ 133 /* Get The Manager Object from the Registry */
134 status = cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT); 134 status = cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT);
135 if (DSP_FAILED(status)) 135 if (status)
136 goto func_cont; 136 goto func_cont;
137 137
138 DBC_ASSERT(pmgr_obj); 138 DBC_ASSERT(pmgr_obj);
@@ -167,7 +167,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
167 167
168func_cont: 168func_cont:
169 DBC_ENSURE((!status && *pu_num_nodes > 0) || 169 DBC_ENSURE((!status && *pu_num_nodes > 0) ||
170 (DSP_FAILED(status) && *pu_num_nodes == 0)); 170 (status && *pu_num_nodes == 0));
171 171
172 return status; 172 return status;
173} 173}
@@ -216,11 +216,11 @@ int mgr_enum_processor_info(u32 processor_id,
216 processor_info->processor_type = DSPTYPE64; 216 processor_info->processor_type = DSPTYPE64;
217 } 217 }
218 } 218 }
219 if (DSP_FAILED(status)) 219 if (status)
220 goto func_end; 220 goto func_end;
221 221
222 /* Get The Manager Object from the Registry */ 222 /* Get The Manager Object from the Registry */
223 if (DSP_FAILED(cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT))) { 223 if (cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT)) {
224 dev_dbg(bridge, "%s: Failed to get MGR Object\n", __func__); 224 dev_dbg(bridge, "%s: Failed to get MGR Object\n", __func__);
225 goto func_end; 225 goto func_end;
226 } 226 }
@@ -319,7 +319,7 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
319 status = 0; 319 status = 0;
320 } 320 }
321 DBC_ENSURE((!status && *dcd_handle != (u32) NULL) || 321 DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
322 (DSP_FAILED(status) && *dcd_handle == (u32) NULL)); 322 (status && *dcd_handle == (u32) NULL));
323 323
324 return status; 324 return status;
325} 325}
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index 993a9be704c..55dfb9825f8 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -399,11 +399,11 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
399 *nldr_nodeobj = (struct nldr_nodeobject *)nldr_node_obj; 399 *nldr_nodeobj = (struct nldr_nodeobject *)nldr_node_obj;
400 } 400 }
401 /* Cleanup on failure */ 401 /* Cleanup on failure */
402 if (DSP_FAILED(status) && nldr_node_obj) 402 if (status && nldr_node_obj)
403 kfree(nldr_node_obj); 403 kfree(nldr_node_obj);
404 404
405 DBC_ENSURE((!status && *nldr_nodeobj) 405 DBC_ENSURE((!status && *nldr_nodeobj)
406 || (DSP_FAILED(status) && *nldr_nodeobj == NULL)); 406 || (status && *nldr_nodeobj == NULL));
407 return status; 407 return status;
408} 408}
409 409
@@ -587,8 +587,7 @@ int nldr_create(struct nldr_object **nldr,
587 *nldr = NULL; 587 *nldr = NULL;
588 } 588 }
589 /* FIXME:Temp. Fix. Must be removed */ 589 /* FIXME:Temp. Fix. Must be removed */
590 DBC_ENSURE((!status && *nldr) 590 DBC_ENSURE((!status && *nldr) || (status && *nldr == NULL));
591 || (DSP_FAILED(status) && (*nldr == NULL)));
592 return status; 591 return status;
593} 592}
594 593
@@ -1012,7 +1011,7 @@ static int add_ovly_node(struct dsp_uuid *uuid_obj,
1012 status = 1011 status =
1013 dcd_get_object_def(nldr_obj->hdcd_mgr, uuid_obj, obj_type, 1012 dcd_get_object_def(nldr_obj->hdcd_mgr, uuid_obj, obj_type,
1014 &obj_def); 1013 &obj_def);
1015 if (DSP_FAILED(status)) 1014 if (status)
1016 goto func_end; 1015 goto func_end;
1017 1016
1018 /* If overlay node, add to the list */ 1017 /* If overlay node, add to the list */
@@ -1422,7 +1421,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
1422 * were loaded, and close the root library. 1421 * were loaded, and close the root library.
1423 * (Persistent libraries are unloaded from the very top) 1422 * (Persistent libraries are unloaded from the very top)
1424 */ 1423 */
1425 if (DSP_FAILED(status)) { 1424 if (status) {
1426 if (phase != NLDR_EXECUTE) { 1425 if (phase != NLDR_EXECUTE) {
1427 for (i = 0; i < nldr_node_obj->pers_libs; i++) 1426 for (i = 0; i < nldr_node_obj->pers_libs; i++)
1428 unload_lib(nldr_node_obj, 1427 unload_lib(nldr_node_obj,
@@ -1593,7 +1592,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
1593 } 1592 }
1594 } 1593 }
1595 } 1594 }
1596 if (DSP_FAILED(status)) { 1595 if (status) {
1597 /* 'Deallocate' memory */ 1596 /* 'Deallocate' memory */
1598 free_sects(nldr_obj, phase_sects, alloc_num); 1597 free_sects(nldr_obj, phase_sects, alloc_num);
1599 free_sects(nldr_obj, other_sects_list, other_alloc); 1598 free_sects(nldr_obj, other_sects_list, other_alloc);
@@ -1684,7 +1683,7 @@ static int remote_alloc(void **ref, u16 mem_sect, u32 size,
1684 rmm_addr_obj->segid = segid; 1683 rmm_addr_obj->segid = segid;
1685 status = 1684 status =
1686 rmm_alloc(rmm, segid, word_size, align, dsp_address, false); 1685 rmm_alloc(rmm, segid, word_size, align, dsp_address, false);
1687 if (DSP_FAILED(status)) { 1686 if (status) {
1688 dev_dbg(bridge, "%s: Unable allocate from segment %d\n", 1687 dev_dbg(bridge, "%s: Unable allocate from segment %d\n",
1689 __func__, segid); 1688 __func__, segid);
1690 } 1689 }
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index d8593fdfbd8..e2d02c410e0 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -345,7 +345,7 @@ int node_allocate(struct proc_object *hprocessor,
345 345
346 } 346 }
347 347
348 if (DSP_FAILED(status)) 348 if (status)
349 goto func_end; 349 goto func_end;
350 350
351 status = dev_get_bridge_context(hdev_obj, &pbridge_context); 351 status = dev_get_bridge_context(hdev_obj, &pbridge_context);
@@ -356,7 +356,7 @@ int node_allocate(struct proc_object *hprocessor,
356 356
357 status = proc_get_state(hprocessor, &proc_state, 357 status = proc_get_state(hprocessor, &proc_state,
358 sizeof(struct dsp_processorstate)); 358 sizeof(struct dsp_processorstate));
359 if (DSP_FAILED(status)) 359 if (status)
360 goto func_end; 360 goto func_end;
361 /* If processor is in error state then don't attempt 361 /* If processor is in error state then don't attempt
362 to send the message */ 362 to send the message */
@@ -380,7 +380,7 @@ int node_allocate(struct proc_object *hprocessor,
380 } 380 }
381 } 381 }
382 /* Allocate node object and fill in */ 382 /* Allocate node object and fill in */
383 if (DSP_FAILED(status)) 383 if (status)
384 goto func_end; 384 goto func_end;
385 385
386 pnode = kzalloc(sizeof(struct node_object), GFP_KERNEL); 386 pnode = kzalloc(sizeof(struct node_object), GFP_KERNEL);
@@ -395,7 +395,7 @@ int node_allocate(struct proc_object *hprocessor,
395 /* Get dsp_ndbprops from node database */ 395 /* Get dsp_ndbprops from node database */
396 status = get_node_props(hnode_mgr->hdcd_mgr, pnode, node_uuid, 396 status = get_node_props(hnode_mgr->hdcd_mgr, pnode, node_uuid,
397 &(pnode->dcd_props)); 397 &(pnode->dcd_props));
398 if (DSP_FAILED(status)) 398 if (status)
399 goto func_cont; 399 goto func_cont;
400 400
401 pnode->node_uuid = *node_uuid; 401 pnode->node_uuid = *node_uuid;
@@ -428,7 +428,7 @@ int node_allocate(struct proc_object *hprocessor,
428 pnode->create_args.asa.task_arg_obj.ugpp_heap_addr = 428 pnode->create_args.asa.task_arg_obj.ugpp_heap_addr =
429 (u32) attr_in->pgpp_virt_addr; 429 (u32) attr_in->pgpp_virt_addr;
430 } 430 }
431 if (DSP_FAILED(status)) 431 if (status)
432 goto func_cont; 432 goto func_cont;
433 433
434 status = proc_reserve_memory(hprocessor, 434 status = proc_reserve_memory(hprocessor,
@@ -437,7 +437,7 @@ int node_allocate(struct proc_object *hprocessor,
437 (void **)&(pnode->create_args.asa. 437 (void **)&(pnode->create_args.asa.
438 task_arg_obj.udsp_heap_res_addr), 438 task_arg_obj.udsp_heap_res_addr),
439 pr_ctxt); 439 pr_ctxt);
440 if (DSP_FAILED(status)) { 440 if (status) {
441 pr_err("%s: Failed to reserve memory for heap: 0x%x\n", 441 pr_err("%s: Failed to reserve memory for heap: 0x%x\n",
442 __func__, status); 442 __func__, status);
443 goto func_cont; 443 goto func_cont;
@@ -460,7 +460,7 @@ int node_allocate(struct proc_object *hprocessor,
460 (void *)pnode->create_args.asa.task_arg_obj. 460 (void *)pnode->create_args.asa.task_arg_obj.
461 udsp_heap_res_addr, (void **)&mapped_addr, map_attrs, 461 udsp_heap_res_addr, (void **)&mapped_addr, map_attrs,
462 pr_ctxt); 462 pr_ctxt);
463 if (DSP_FAILED(status)) 463 if (status)
464 pr_err("%s: Failed to map memory for Heap: 0x%x\n", 464 pr_err("%s: Failed to map memory for Heap: 0x%x\n",
465 __func__, status); 465 __func__, status);
466 else 466 else
@@ -597,7 +597,7 @@ func_cont:
597 hnode_mgr->nldr_fxns. 597 hnode_mgr->nldr_fxns.
598 pfn_get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG", 598 pfn_get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG",
599 &dynext_base); 599 &dynext_base);
600 if (DSP_FAILED(status)) 600 if (status)
601 pr_err("%s: Failed to get addr for DYNEXT_BEG" 601 pr_err("%s: Failed to get addr for DYNEXT_BEG"
602 " status = 0x%x\n", __func__, status); 602 " status = 0x%x\n", __func__, status);
603 603
@@ -606,7 +606,7 @@ func_cont:
606 pfn_get_fxn_addr(pnode->nldr_node_obj, 606 pfn_get_fxn_addr(pnode->nldr_node_obj,
607 "L1DSRAM_HEAP", &pul_value); 607 "L1DSRAM_HEAP", &pul_value);
608 608
609 if (DSP_FAILED(status)) 609 if (status)
610 pr_err("%s: Failed to get addr for L1DSRAM_HEAP" 610 pr_err("%s: Failed to get addr for L1DSRAM_HEAP"
611 " status = 0x%x\n", __func__, status); 611 " status = 0x%x\n", __func__, status);
612 612
@@ -614,7 +614,7 @@ func_cont:
614 if (!host_res) 614 if (!host_res)
615 status = -EPERM; 615 status = -EPERM;
616 616
617 if (DSP_FAILED(status)) { 617 if (status) {
618 pr_err("%s: Failed to get host resource, status" 618 pr_err("%s: Failed to get host resource, status"
619 " = 0x%x\n", __func__, status); 619 " = 0x%x\n", __func__, status);
620 goto func_end; 620 goto func_end;
@@ -670,7 +670,7 @@ func_cont:
670 drv_proc_node_update_heap_status(node_res, true); 670 drv_proc_node_update_heap_status(node_res, true);
671 drv_proc_node_update_status(node_res, true); 671 drv_proc_node_update_status(node_res, true);
672 } 672 }
673 DBC_ENSURE((DSP_FAILED(status) && (*ph_node == NULL)) || 673 DBC_ENSURE((status && (*ph_node == NULL)) ||
674 (!status && *ph_node)); 674 (!status && *ph_node));
675func_end: 675func_end:
676 dev_dbg(bridge, "%s: hprocessor: %p node_uuid: %p pargs: %p attr_in:" 676 dev_dbg(bridge, "%s: hprocessor: %p node_uuid: %p pargs: %p attr_in:"
@@ -704,7 +704,7 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
704 else if (node_get_type(pnode) == NODE_DEVICE) 704 else if (node_get_type(pnode) == NODE_DEVICE)
705 status = -EPERM; 705 status = -EPERM;
706 706
707 if (DSP_FAILED(status)) 707 if (status)
708 goto func_end; 708 goto func_end;
709 709
710 if (pattr == NULL) 710 if (pattr == NULL)
@@ -792,7 +792,7 @@ int node_change_priority(struct node_object *hnode, s32 prio)
792 else if (prio < hnode_mgr->min_pri || prio > hnode_mgr->max_pri) 792 else if (prio < hnode_mgr->min_pri || prio > hnode_mgr->max_pri)
793 status = -EDOM; 793 status = -EDOM;
794 } 794 }
795 if (DSP_FAILED(status)) 795 if (status)
796 goto func_end; 796 goto func_end;
797 797
798 /* Enter critical section */ 798 /* Enter critical section */
@@ -905,7 +905,7 @@ int node_connect(struct node_object *node1, u32 stream1,
905 status = -EPERM; /* illegal stream mode */ 905 status = -EPERM; /* illegal stream mode */
906 906
907 } 907 }
908 if (DSP_FAILED(status)) 908 if (status)
909 goto func_end; 909 goto func_end;
910 910
911 if (node1_type != NODE_GPP) { 911 if (node1_type != NODE_GPP) {
@@ -1167,7 +1167,7 @@ int node_create(struct node_object *hnode)
1167 hprocessor = hnode->hprocessor; 1167 hprocessor = hnode->hprocessor;
1168 status = proc_get_state(hprocessor, &proc_state, 1168 status = proc_get_state(hprocessor, &proc_state,
1169 sizeof(struct dsp_processorstate)); 1169 sizeof(struct dsp_processorstate));
1170 if (DSP_FAILED(status)) 1170 if (status)
1171 goto func_end; 1171 goto func_end;
1172 /* If processor is in error state then don't attempt to create 1172 /* If processor is in error state then don't attempt to create
1173 new node */ 1173 new node */
@@ -1190,7 +1190,7 @@ int node_create(struct node_object *hnode)
1190 if (!status) 1190 if (!status)
1191 status = proc_get_processor_id(pnode->hprocessor, &proc_id); 1191 status = proc_get_processor_id(pnode->hprocessor, &proc_id);
1192 1192
1193 if (DSP_FAILED(status)) 1193 if (status)
1194 goto func_cont2; 1194 goto func_cont2;
1195 1195
1196 if (proc_id != DSP_UNIT) 1196 if (proc_id != DSP_UNIT)
@@ -1267,7 +1267,7 @@ int node_create(struct node_object *hnode)
1267 NLDR_CREATE); 1267 NLDR_CREATE);
1268 hnode->loaded = false; 1268 hnode->loaded = false;
1269 } 1269 }
1270 if (DSP_FAILED(status1)) 1270 if (status1)
1271 pr_err("%s: Failed to unload create code: 0x%x\n", 1271 pr_err("%s: Failed to unload create code: 0x%x\n",
1272 __func__, status1); 1272 __func__, status1);
1273func_cont2: 1273func_cont2:
@@ -1421,8 +1421,7 @@ int node_create_mgr(struct node_mgr **node_man,
1421 else 1421 else
1422 delete_node_mgr(node_mgr_obj); 1422 delete_node_mgr(node_mgr_obj);
1423 1423
1424 DBC_ENSURE((DSP_FAILED(status) && (*node_man == NULL)) || 1424 DBC_ENSURE((status && *node_man == NULL) || (!status && *node_man));
1425 (!status && *node_man));
1426 1425
1427 return status; 1426 return status;
1428} 1427}
@@ -1478,7 +1477,7 @@ int node_delete(struct node_object *hnode,
1478 if (!(state == NODE_ALLOCATED && hnode->node_env == (u32) NULL) && 1477 if (!(state == NODE_ALLOCATED && hnode->node_env == (u32) NULL) &&
1479 node_type != NODE_DEVICE) { 1478 node_type != NODE_DEVICE) {
1480 status = proc_get_processor_id(pnode->hprocessor, &proc_id); 1479 status = proc_get_processor_id(pnode->hprocessor, &proc_id);
1481 if (DSP_FAILED(status)) 1480 if (status)
1482 goto func_cont1; 1481 goto func_cont1;
1483 1482
1484 if (proc_id == DSP_UNIT || proc_id == IVA_UNIT) { 1483 if (proc_id == DSP_UNIT || proc_id == IVA_UNIT) {
@@ -1549,7 +1548,7 @@ func_cont1:
1549 pfn_unload(hnode->nldr_node_obj, 1548 pfn_unload(hnode->nldr_node_obj,
1550 NLDR_EXECUTE); 1549 NLDR_EXECUTE);
1551 } 1550 }
1552 if (DSP_FAILED(status1)) 1551 if (status1)
1553 pr_err("%s: fail - unload execute code:" 1552 pr_err("%s: fail - unload execute code:"
1554 " 0x%x\n", __func__, status1); 1553 " 0x%x\n", __func__, status1);
1555 1554
@@ -1558,7 +1557,7 @@ func_cont1:
1558 nldr_node_obj, 1557 nldr_node_obj,
1559 NLDR_DELETE); 1558 NLDR_DELETE);
1560 hnode->loaded = false; 1559 hnode->loaded = false;
1561 if (DSP_FAILED(status1)) 1560 if (status1)
1562 pr_err("%s: fail - unload delete code: " 1561 pr_err("%s: fail - unload delete code: "
1563 "0x%x\n", __func__, status1); 1562 "0x%x\n", __func__, status1);
1564 } 1563 }
@@ -1822,7 +1821,7 @@ int node_get_message(struct node_object *hnode,
1822 hprocessor = hnode->hprocessor; 1821 hprocessor = hnode->hprocessor;
1823 status = proc_get_state(hprocessor, &proc_state, 1822 status = proc_get_state(hprocessor, &proc_state,
1824 sizeof(struct dsp_processorstate)); 1823 sizeof(struct dsp_processorstate));
1825 if (DSP_FAILED(status)) 1824 if (status)
1826 goto func_end; 1825 goto func_end;
1827 /* If processor is in error state then don't attempt to get the 1826 /* If processor is in error state then don't attempt to get the
1828 message */ 1827 message */
@@ -1846,7 +1845,7 @@ int node_get_message(struct node_object *hnode,
1846 status = 1845 status =
1847 (*intf_fxns->pfn_msg_get) (hnode->msg_queue_obj, message, utimeout); 1846 (*intf_fxns->pfn_msg_get) (hnode->msg_queue_obj, message, utimeout);
1848 /* Check if message contains SM descriptor */ 1847 /* Check if message contains SM descriptor */
1849 if (DSP_FAILED(status) || !(message->dw_cmd & DSP_RMSBUFDESC)) 1848 if (status || !(message->dw_cmd & DSP_RMSBUFDESC))
1850 goto func_end; 1849 goto func_end;
1851 1850
1852 /* Translate DSP byte addr to GPP Va. */ 1851 /* Translate DSP byte addr to GPP Va. */
@@ -2030,7 +2029,7 @@ int node_pause(struct node_object *hnode)
2030 if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET) 2029 if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET)
2031 status = -EPERM; 2030 status = -EPERM;
2032 } 2031 }
2033 if (DSP_FAILED(status)) 2032 if (status)
2034 goto func_end; 2033 goto func_end;
2035 2034
2036 status = proc_get_processor_id(pnode->hprocessor, &proc_id); 2035 status = proc_get_processor_id(pnode->hprocessor, &proc_id);
@@ -2048,12 +2047,12 @@ int node_pause(struct node_object *hnode)
2048 if (state != NODE_RUNNING) 2047 if (state != NODE_RUNNING)
2049 status = -EBADR; 2048 status = -EBADR;
2050 2049
2051 if (DSP_FAILED(status)) 2050 if (status)
2052 goto func_cont; 2051 goto func_cont;
2053 hprocessor = hnode->hprocessor; 2052 hprocessor = hnode->hprocessor;
2054 status = proc_get_state(hprocessor, &proc_state, 2053 status = proc_get_state(hprocessor, &proc_state,
2055 sizeof(struct dsp_processorstate)); 2054 sizeof(struct dsp_processorstate));
2056 if (DSP_FAILED(status)) 2055 if (status)
2057 goto func_cont; 2056 goto func_cont;
2058 /* If processor is in error state then don't attempt 2057 /* If processor is in error state then don't attempt
2059 to send the message */ 2058 to send the message */
@@ -2115,7 +2114,7 @@ int node_put_message(struct node_object *hnode,
2115 hprocessor = hnode->hprocessor; 2114 hprocessor = hnode->hprocessor;
2116 status = proc_get_state(hprocessor, &proc_state, 2115 status = proc_get_state(hprocessor, &proc_state,
2117 sizeof(struct dsp_processorstate)); 2116 sizeof(struct dsp_processorstate));
2118 if (DSP_FAILED(status)) 2117 if (status)
2119 goto func_end; 2118 goto func_end;
2120 /* If processor is in bad state then don't attempt sending the 2119 /* If processor is in bad state then don't attempt sending the
2121 message */ 2120 message */
@@ -2145,7 +2144,7 @@ int node_put_message(struct node_object *hnode,
2145 /* end of sync_enter_cs */ 2144 /* end of sync_enter_cs */
2146 mutex_unlock(&hnode_mgr->node_mgr_lock); 2145 mutex_unlock(&hnode_mgr->node_mgr_lock);
2147 } 2146 }
2148 if (DSP_FAILED(status)) 2147 if (status)
2149 goto func_end; 2148 goto func_end;
2150 2149
2151 /* assign pmsg values to new msg */ 2150 /* assign pmsg values to new msg */
@@ -2267,7 +2266,7 @@ int node_run(struct node_object *hnode)
2267 hprocessor = hnode->hprocessor; 2266 hprocessor = hnode->hprocessor;
2268 status = proc_get_state(hprocessor, &proc_state, 2267 status = proc_get_state(hprocessor, &proc_state,
2269 sizeof(struct dsp_processorstate)); 2268 sizeof(struct dsp_processorstate));
2270 if (DSP_FAILED(status)) 2269 if (status)
2271 goto func_end; 2270 goto func_end;
2272 /* If processor is in error state then don't attempt to run the node */ 2271 /* If processor is in error state then don't attempt to run the node */
2273 if (proc_state.proc_state == PROC_ERROR) { 2272 if (proc_state.proc_state == PROC_ERROR) {
@@ -2277,7 +2276,7 @@ int node_run(struct node_object *hnode)
2277 node_type = node_get_type(hnode); 2276 node_type = node_get_type(hnode);
2278 if (node_type == NODE_DEVICE) 2277 if (node_type == NODE_DEVICE)
2279 status = -EPERM; 2278 status = -EPERM;
2280 if (DSP_FAILED(status)) 2279 if (status)
2281 goto func_end; 2280 goto func_end;
2282 2281
2283 hnode_mgr = hnode->hnode_mgr; 2282 hnode_mgr = hnode->hnode_mgr;
@@ -2296,7 +2295,7 @@ int node_run(struct node_object *hnode)
2296 if (!status) 2295 if (!status)
2297 status = proc_get_processor_id(pnode->hprocessor, &proc_id); 2296 status = proc_get_processor_id(pnode->hprocessor, &proc_id);
2298 2297
2299 if (DSP_FAILED(status)) 2298 if (status)
2300 goto func_cont1; 2299 goto func_cont1;
2301 2300
2302 if ((proc_id != DSP_UNIT) && (proc_id != IVA_UNIT)) 2301 if ((proc_id != DSP_UNIT) && (proc_id != IVA_UNIT))
@@ -2420,7 +2419,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
2420 */ 2419 */
2421 status = proc_get_state(pnode->hprocessor, &proc_state, 2420 status = proc_get_state(pnode->hprocessor, &proc_state,
2422 sizeof(struct dsp_processorstate)); 2421 sizeof(struct dsp_processorstate));
2423 if (DSP_FAILED(status)) 2422 if (status)
2424 goto func_cont; 2423 goto func_cont;
2425 /* If processor is in error state then don't attempt to send 2424 /* If processor is in error state then don't attempt to send
2426 * A kill task command */ 2425 * A kill task command */
@@ -2442,7 +2441,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
2442 2441
2443 status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj, &msg, 2442 status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj, &msg,
2444 hnode->utimeout); 2443 hnode->utimeout);
2445 if (DSP_FAILED(status)) 2444 if (status)
2446 goto func_cont; 2445 goto func_cont;
2447 2446
2448 /* 2447 /*
@@ -2458,11 +2457,11 @@ int node_terminate(struct node_object *hnode, int *pstatus)
2458 2457
2459 status = (*intf_fxns->pfn_msg_put)(hnode->msg_queue_obj, 2458 status = (*intf_fxns->pfn_msg_put)(hnode->msg_queue_obj,
2460 &killmsg, hnode->utimeout); 2459 &killmsg, hnode->utimeout);
2461 if (DSP_FAILED(status)) 2460 if (status)
2462 goto func_cont; 2461 goto func_cont;
2463 status = sync_wait_on_event(hnode->sync_done, 2462 status = sync_wait_on_event(hnode->sync_done,
2464 kill_time_out / 2); 2463 kill_time_out / 2);
2465 if (DSP_FAILED(status)) { 2464 if (status) {
2466 /* 2465 /*
2467 * Here it goes the part of the simulation of 2466 * Here it goes the part of the simulation of
2468 * the DSP exception. 2467 * the DSP exception.
@@ -3022,7 +3021,7 @@ int node_get_uuid_props(void *hprocessor,
3022 } 3021 }
3023 status = proc_get_state(hprocessor, &proc_state, 3022 status = proc_get_state(hprocessor, &proc_state,
3024 sizeof(struct dsp_processorstate)); 3023 sizeof(struct dsp_processorstate));
3025 if (DSP_FAILED(status)) 3024 if (status)
3026 goto func_end; 3025 goto func_end;
3027 /* If processor is in error state then don't attempt 3026 /* If processor is in error state then don't attempt
3028 to send the message */ 3027 to send the message */
@@ -3099,7 +3098,7 @@ static int get_rms_fxns(struct node_mgr *hnode_mgr)
3099 for (i = 0; i < NUMRMSFXNS; i++) { 3098 for (i = 0; i < NUMRMSFXNS; i++) {
3100 status = dev_get_symbol(dev_obj, psz_fxns[i], 3099 status = dev_get_symbol(dev_obj, psz_fxns[i],
3101 &(hnode_mgr->ul_fxn_addrs[i])); 3100 &(hnode_mgr->ul_fxn_addrs[i]));
3102 if (DSP_FAILED(status)) { 3101 if (status) {
3103 if (status == -ESPIPE) { 3102 if (status == -ESPIPE) {
3104 /* 3103 /*
3105 * May be loaded dynamically (in the future), 3104 * May be loaded dynamically (in the future),
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index 570927ff067..6258d8bad91 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -302,7 +302,7 @@ proc_attach(u32 processor_id,
302 if (!status) 302 if (!status)
303 status = dev_get_dev_type(hdev_obj, &dev_type); 303 status = dev_get_dev_type(hdev_obj, &dev_type);
304 304
305 if (DSP_FAILED(status)) 305 if (status)
306 goto func_end; 306 goto func_end;
307 307
308 /* If we made it this far, create the Proceesor object: */ 308 /* If we made it this far, create the Proceesor object: */
@@ -329,12 +329,12 @@ proc_attach(u32 processor_id,
329 if (!status) { 329 if (!status) {
330 status = dev_get_bridge_context(hdev_obj, 330 status = dev_get_bridge_context(hdev_obj,
331 &p_proc_object->hbridge_context); 331 &p_proc_object->hbridge_context);
332 if (DSP_FAILED(status)) 332 if (status)
333 kfree(p_proc_object); 333 kfree(p_proc_object);
334 } else 334 } else
335 kfree(p_proc_object); 335 kfree(p_proc_object);
336 336
337 if (DSP_FAILED(status)) 337 if (status)
338 goto func_end; 338 goto func_end;
339 339
340 /* Create the Notification Object */ 340 /* Create the Notification Object */
@@ -376,7 +376,7 @@ proc_attach(u32 processor_id,
376 DSP_PROCESSORATTACH); 376 DSP_PROCESSORATTACH);
377 } 377 }
378 } else { 378 } else {
379 /* Don't leak memory if DSP_FAILED */ 379 /* Don't leak memory if status is failed */
380 kfree(p_proc_object); 380 kfree(p_proc_object);
381 } 381 }
382func_end: 382func_end:
@@ -437,7 +437,7 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
437 437
438 /* Create a Dummy PROC Object */ 438 /* Create a Dummy PROC Object */
439 status = cfg_get_object((u32 *) &hmgr_obj, REG_MGR_OBJECT); 439 status = cfg_get_object((u32 *) &hmgr_obj, REG_MGR_OBJECT);
440 if (DSP_FAILED(status)) 440 if (status)
441 goto func_end; 441 goto func_end;
442 442
443 p_proc_object = kzalloc(sizeof(struct proc_object), GFP_KERNEL); 443 p_proc_object = kzalloc(sizeof(struct proc_object), GFP_KERNEL);
@@ -451,13 +451,13 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
451 if (!status) 451 if (!status)
452 status = dev_get_bridge_context(hdev_obj, 452 status = dev_get_bridge_context(hdev_obj,
453 &p_proc_object->hbridge_context); 453 &p_proc_object->hbridge_context);
454 if (DSP_FAILED(status)) 454 if (status)
455 goto func_cont; 455 goto func_cont;
456 456
457 /* Stop the Device, put it into standby mode */ 457 /* Stop the Device, put it into standby mode */
458 status = proc_stop(p_proc_object); 458 status = proc_stop(p_proc_object);
459 459
460 if (DSP_FAILED(status)) 460 if (status)
461 goto func_cont; 461 goto func_cont;
462 462
463 /* Get the default executable for this board... */ 463 /* Get the default executable for this board... */
@@ -953,7 +953,7 @@ int proc_get_dev_object(void *hprocessor,
953 } 953 }
954 954
955 DBC_ENSURE((!status && *device_obj != NULL) || 955 DBC_ENSURE((!status && *device_obj != NULL) ||
956 (DSP_FAILED(status) && *device_obj == NULL)); 956 (status && *device_obj == NULL));
957 957
958 return status; 958 return status;
959} 959}
@@ -1103,12 +1103,12 @@ int proc_load(void *hprocessor, const s32 argc_index,
1103 goto func_end; 1103 goto func_end;
1104 } 1104 }
1105 status = proc_stop(hprocessor); 1105 status = proc_stop(hprocessor);
1106 if (DSP_FAILED(status)) 1106 if (status)
1107 goto func_end; 1107 goto func_end;
1108 1108
1109 /* Place the board in the monitor state. */ 1109 /* Place the board in the monitor state. */
1110 status = proc_monitor(hprocessor); 1110 status = proc_monitor(hprocessor);
1111 if (DSP_FAILED(status)) 1111 if (status)
1112 goto func_end; 1112 goto func_end;
1113 1113
1114 /* Save ptr to original argv[0]. */ 1114 /* Save ptr to original argv[0]. */
@@ -1174,7 +1174,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
1174 if (status == -EACCES) 1174 if (status == -EACCES)
1175 status = 0; 1175 status = 0;
1176 1176
1177 if (DSP_FAILED(status)) { 1177 if (status) {
1178 status = -EPERM; 1178 status = -EPERM;
1179 } else { 1179 } else {
1180 DBC_ASSERT(p_proc_object->psz_last_coff == 1180 DBC_ASSERT(p_proc_object->psz_last_coff ==
@@ -1225,7 +1225,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
1225 status = cod_load_base(cod_mgr, argc_index, (char **)user_args, 1225 status = cod_load_base(cod_mgr, argc_index, (char **)user_args,
1226 dev_brd_write_fxn, 1226 dev_brd_write_fxn,
1227 p_proc_object->hdev_obj, NULL); 1227 p_proc_object->hdev_obj, NULL);
1228 if (DSP_FAILED(status)) { 1228 if (status) {
1229 if (status == -EBADF) { 1229 if (status == -EBADF) {
1230 dev_dbg(bridge, "%s: Failure to Load the EXE\n", 1230 dev_dbg(bridge, "%s: Failure to Load the EXE\n",
1231 __func__); 1231 __func__);
@@ -1302,12 +1302,12 @@ int proc_load(void *hprocessor, const s32 argc_index,
1302 } 1302 }
1303 1303
1304func_end: 1304func_end:
1305 if (DSP_FAILED(status)) 1305 if (status)
1306 pr_err("%s: Processor failed to load\n", __func__); 1306 pr_err("%s: Processor failed to load\n", __func__);
1307 1307
1308 DBC_ENSURE((!status 1308 DBC_ENSURE((!status
1309 && p_proc_object->proc_state == PROC_LOADED) 1309 && p_proc_object->proc_state == PROC_LOADED)
1310 || DSP_FAILED(status)); 1310 || status);
1311#ifdef OPT_LOAD_TIME_INSTRUMENTATION 1311#ifdef OPT_LOAD_TIME_INSTRUMENTATION
1312 do_gettimeofday(&tv2); 1312 do_gettimeofday(&tv2);
1313 if (tv2.tv_usec < tv1.tv_usec) { 1313 if (tv2.tv_usec < tv1.tv_usec) {
@@ -1391,7 +1391,7 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
1391 } 1391 }
1392 mutex_unlock(&proc_lock); 1392 mutex_unlock(&proc_lock);
1393 1393
1394 if (DSP_FAILED(status)) 1394 if (status)
1395 goto func_end; 1395 goto func_end;
1396 1396
1397func_end: 1397func_end:
@@ -1454,7 +1454,7 @@ int proc_register_notify(void *hprocessor, u32 event_mask,
1454 * so if we're trying to deregister and ntfy_register 1454 * so if we're trying to deregister and ntfy_register
1455 * failed, we'll give the deh manager a shot. 1455 * failed, we'll give the deh manager a shot.
1456 */ 1456 */
1457 if ((event_mask == 0) && DSP_FAILED(status)) { 1457 if ((event_mask == 0) && status) {
1458 status = 1458 status =
1459 dev_get_deh_mgr(p_proc_object->hdev_obj, 1459 dev_get_deh_mgr(p_proc_object->hdev_obj,
1460 &hdeh_mgr); 1460 &hdeh_mgr);
@@ -1558,12 +1558,12 @@ int proc_start(void *hprocessor)
1558 } 1558 }
1559 1559
1560 status = cod_get_entry(cod_mgr, &dw_dsp_addr); 1560 status = cod_get_entry(cod_mgr, &dw_dsp_addr);
1561 if (DSP_FAILED(status)) 1561 if (status)
1562 goto func_cont; 1562 goto func_cont;
1563 1563
1564 status = (*p_proc_object->intf_fxns->pfn_brd_start) 1564 status = (*p_proc_object->intf_fxns->pfn_brd_start)
1565 (p_proc_object->hbridge_context, dw_dsp_addr); 1565 (p_proc_object->hbridge_context, dw_dsp_addr);
1566 if (DSP_FAILED(status)) 1566 if (status)
1567 goto func_cont; 1567 goto func_cont;
1568 1568
1569 /* Call dev_create2 */ 1569 /* Call dev_create2 */
@@ -1598,7 +1598,7 @@ func_cont:
1598 1598
1599func_end: 1599func_end:
1600 DBC_ENSURE((!status && p_proc_object->proc_state == 1600 DBC_ENSURE((!status && p_proc_object->proc_state ==
1601 PROC_RUNNING) || DSP_FAILED(status)); 1601 PROC_RUNNING) || status);
1602 return status; 1602 return status;
1603} 1603}
1604 1604
@@ -1705,7 +1705,7 @@ int proc_un_map(void *hprocessor, void *map_addr,
1705 } 1705 }
1706 1706
1707 mutex_unlock(&proc_lock); 1707 mutex_unlock(&proc_lock);
1708 if (DSP_FAILED(status)) 1708 if (status)
1709 goto func_end; 1709 goto func_end;
1710 1710
1711 /* 1711 /*
@@ -1817,7 +1817,7 @@ static int proc_monitor(struct proc_object *proc_obj)
1817 } 1817 }
1818 1818
1819 DBC_ENSURE((!status && brd_state == BRD_IDLE) || 1819 DBC_ENSURE((!status && brd_state == BRD_IDLE) ||
1820 DSP_FAILED(status)); 1820 status);
1821 return status; 1821 return status;
1822} 1822}
1823 1823
diff --git a/drivers/staging/tidspbridge/rmgr/pwr.c b/drivers/staging/tidspbridge/rmgr/pwr.c
index 69c2e19c81f..85cb1a2bc0b 100644
--- a/drivers/staging/tidspbridge/rmgr/pwr.c
+++ b/drivers/staging/tidspbridge/rmgr/pwr.c
@@ -49,14 +49,14 @@ int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
49 hdev_obj != NULL; 49 hdev_obj != NULL;
50 hdev_obj = 50 hdev_obj =
51 (struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) { 51 (struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
52 if (DSP_FAILED(dev_get_bridge_context(hdev_obj, 52 if (dev_get_bridge_context(hdev_obj,
53 (struct bridge_dev_context **) 53 (struct bridge_dev_context **)
54 &dw_context))) { 54 &dw_context)) {
55 continue; 55 continue;
56 } 56 }
57 if (DSP_FAILED(dev_get_intf_fxns(hdev_obj, 57 if (dev_get_intf_fxns(hdev_obj,
58 (struct bridge_drv_interface **) 58 (struct bridge_drv_interface **)
59 &intf_fxns))) { 59 &intf_fxns)) {
60 continue; 60 continue;
61 } 61 }
62 if (sleep_code == PWR_DEEPSLEEP) 62 if (sleep_code == PWR_DEEPSLEEP)
diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c b/drivers/staging/tidspbridge/rmgr/rmm.c
index 633d441bb80..761e8f4fa46 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -186,7 +186,7 @@ int rmm_create(struct rmm_target_obj **target_obj,
186 if (target == NULL) 186 if (target == NULL)
187 status = -ENOMEM; 187 status = -ENOMEM;
188 188
189 if (DSP_FAILED(status)) 189 if (status)
190 goto func_cont; 190 goto func_cont;
191 191
192 target->num_segs = num_segs; 192 target->num_segs = num_segs;
@@ -249,7 +249,7 @@ func_cont:
249 } 249 }
250 250
251 DBC_ENSURE((!status && *target_obj) 251 DBC_ENSURE((!status && *target_obj)
252 || (DSP_FAILED(status) && *target_obj == NULL)); 252 || (status && *target_obj == NULL));
253 253
254 return status; 254 return status;
255} 255}
diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c
index 35d63785344..df8458e874c 100644
--- a/drivers/staging/tidspbridge/rmgr/strm.c
+++ b/drivers/staging/tidspbridge/rmgr/strm.c
@@ -120,7 +120,7 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
120 status = -EFAULT; 120 status = -EFAULT;
121 } 121 }
122 122
123 if (DSP_FAILED(status)) 123 if (status)
124 goto func_end; 124 goto func_end;
125 125
126 for (i = 0; i < num_bufs; i++) { 126 for (i = 0; i < num_bufs; i++) {
@@ -133,10 +133,10 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
133 break; 133 break;
134 } 134 }
135 } 135 }
136 if (DSP_FAILED(status)) 136 if (status)
137 strm_free_buffer(stream_obj, ap_buffer, alloc_cnt, pr_ctxt); 137 strm_free_buffer(stream_obj, ap_buffer, alloc_cnt, pr_ctxt);
138 138
139 if (DSP_FAILED(status)) 139 if (status)
140 goto func_end; 140 goto func_end;
141 141
142 if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) != 142 if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -180,7 +180,7 @@ int strm_close(struct strm_object *stream_obj,
180 status = delete_strm(stream_obj); 180 status = delete_strm(stream_obj);
181 } 181 }
182 182
183 if (DSP_FAILED(status)) 183 if (status)
184 goto func_end; 184 goto func_end;
185 185
186 if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) != 186 if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -233,8 +233,7 @@ int strm_create(struct strm_mgr **strm_man,
233 else 233 else
234 kfree(strm_mgr_obj); 234 kfree(strm_mgr_obj);
235 235
236 DBC_ENSURE((!status && *strm_man) || 236 DBC_ENSURE((!status && *strm_man) || (status && *strm_man == NULL));
237 (DSP_FAILED(status) && *strm_man == NULL));
238 237
239 return status; 238 return status;
240} 239}
@@ -291,7 +290,7 @@ int strm_free_buffer(struct strm_object *stream_obj, u8 ** ap_buffer,
291 status = 290 status =
292 cmm_xlator_free_buf(stream_obj->xlator, 291 cmm_xlator_free_buf(stream_obj->xlator,
293 ap_buffer[i]); 292 ap_buffer[i]);
294 if (DSP_FAILED(status)) 293 if (status)
295 break; 294 break;
296 ap_buffer[i] = NULL; 295 ap_buffer[i] = NULL;
297 } 296 }
@@ -329,14 +328,14 @@ int strm_get_info(struct strm_object *stream_obj,
329 status = -EINVAL; 328 status = -EINVAL;
330 } 329 }
331 } 330 }
332 if (DSP_FAILED(status)) 331 if (status)
333 goto func_end; 332 goto func_end;
334 333
335 intf_fxns = stream_obj->strm_mgr_obj->intf_fxns; 334 intf_fxns = stream_obj->strm_mgr_obj->intf_fxns;
336 status = 335 status =
337 (*intf_fxns->pfn_chnl_get_info) (stream_obj->chnl_obj, 336 (*intf_fxns->pfn_chnl_get_info) (stream_obj->chnl_obj,
338 &chnl_info_obj); 337 &chnl_info_obj);
339 if (DSP_FAILED(status)) 338 if (status)
340 goto func_end; 339 goto func_end;
341 340
342 if (stream_obj->xlator) { 341 if (stream_obj->xlator) {
@@ -540,7 +539,7 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
540 539
541 } 540 }
542 } 541 }
543 if (DSP_FAILED(status)) 542 if (status)
544 goto func_cont; 543 goto func_cont;
545 544
546 if ((pattr->virt_base == NULL) || !(pattr->ul_virt_size > 0)) 545 if ((pattr->virt_base == NULL) || !(pattr->ul_virt_size > 0))
@@ -572,7 +571,7 @@ func_cont:
572 strm_mgr_obj->hchnl_mgr, 571 strm_mgr_obj->hchnl_mgr,
573 chnl_mode, ul_chnl_id, 572 chnl_mode, ul_chnl_id,
574 &chnl_attr_obj); 573 &chnl_attr_obj);
575 if (DSP_FAILED(status)) { 574 if (status) {
576 /* 575 /*
577 * over-ride non-returnable status codes so we return 576 * over-ride non-returnable status codes so we return
578 * something documented 577 * something documented
@@ -767,7 +766,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
767 break; 766 break;
768 } 767 }
769 } 768 }
770 if (DSP_FAILED(status)) 769 if (status)
771 goto func_end; 770 goto func_end;
772 771
773 /* Determine which channels have IO ready */ 772 /* Determine which channels have IO ready */
@@ -775,7 +774,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
775 intf_fxns = strm_tab[i]->strm_mgr_obj->intf_fxns; 774 intf_fxns = strm_tab[i]->strm_mgr_obj->intf_fxns;
776 status = (*intf_fxns->pfn_chnl_get_info) (strm_tab[i]->chnl_obj, 775 status = (*intf_fxns->pfn_chnl_get_info) (strm_tab[i]->chnl_obj,
777 &chnl_info_obj); 776 &chnl_info_obj);
778 if (DSP_FAILED(status)) { 777 if (status) {
779 break; 778 break;
780 } else { 779 } else {
781 if (chnl_info_obj.cio_cs > 0) 780 if (chnl_info_obj.cio_cs > 0)
@@ -796,7 +795,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
796 strm_tab[i]->strm_mgr_obj->intf_fxns; 795 strm_tab[i]->strm_mgr_obj->intf_fxns;
797 status = (*intf_fxns->pfn_chnl_get_info) 796 status = (*intf_fxns->pfn_chnl_get_info)
798 (strm_tab[i]->chnl_obj, &chnl_info_obj); 797 (strm_tab[i]->chnl_obj, &chnl_info_obj);
799 if (DSP_FAILED(status)) 798 if (status)
800 break; 799 break;
801 else 800 else
802 sync_events[i] = 801 sync_events[i] =
@@ -820,7 +819,7 @@ func_end:
820 kfree(sync_events); 819 kfree(sync_events);
821 820
822 DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) || 821 DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) ||
823 (DSP_FAILED(status) && *pmask == 0)); 822 (status && *pmask == 0));
824 823
825 return status; 824 return status;
826} 825}