diff options
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/cod.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c index 10db8cf041d..0cbe6e5f6ec 100644 --- a/drivers/staging/tidspbridge/pmgr/cod.c +++ b/drivers/staging/tidspbridge/pmgr/cod.c | |||
@@ -46,9 +46,6 @@ | |||
46 | /* magic number for handle validation */ | 46 | /* magic number for handle validation */ |
47 | #define MAGIC 0xc001beef | 47 | #define MAGIC 0xc001beef |
48 | 48 | ||
49 | /* macro to validate COD manager handles */ | ||
50 | #define IS_VALID(h) ((h) != NULL && (h)->ul_magic == MAGIC) | ||
51 | |||
52 | /* | 49 | /* |
53 | * ======== cod_manager ======== | 50 | * ======== cod_manager ======== |
54 | */ | 51 | */ |
@@ -199,7 +196,7 @@ void cod_close(struct cod_libraryobj *lib) | |||
199 | 196 | ||
200 | DBC_REQUIRE(refs > 0); | 197 | DBC_REQUIRE(refs > 0); |
201 | DBC_REQUIRE(lib != NULL); | 198 | DBC_REQUIRE(lib != NULL); |
202 | DBC_REQUIRE(IS_VALID(((struct cod_libraryobj *)lib)->cod_mgr)); | 199 | DBC_REQUIRE(lib->cod_mgr); |
203 | 200 | ||
204 | hmgr = lib->cod_mgr; | 201 | hmgr = lib->cod_mgr; |
205 | hmgr->fxns.close_fxn(lib->dbll_lib); | 202 | hmgr->fxns.close_fxn(lib->dbll_lib); |
@@ -285,7 +282,7 @@ int cod_create(struct cod_manager **mgr, char *str_zl_file, | |||
285 | void cod_delete(struct cod_manager *cod_mgr_obj) | 282 | void cod_delete(struct cod_manager *cod_mgr_obj) |
286 | { | 283 | { |
287 | DBC_REQUIRE(refs > 0); | 284 | DBC_REQUIRE(refs > 0); |
288 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 285 | DBC_REQUIRE(cod_mgr_obj); |
289 | 286 | ||
290 | if (cod_mgr_obj->base_lib) { | 287 | if (cod_mgr_obj->base_lib) { |
291 | if (cod_mgr_obj->loaded) | 288 | if (cod_mgr_obj->loaded) |
@@ -328,7 +325,7 @@ int cod_get_base_lib(struct cod_manager *cod_mgr_obj, | |||
328 | int status = 0; | 325 | int status = 0; |
329 | 326 | ||
330 | DBC_REQUIRE(refs > 0); | 327 | DBC_REQUIRE(refs > 0); |
331 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 328 | DBC_REQUIRE(cod_mgr_obj); |
332 | DBC_REQUIRE(plib != NULL); | 329 | DBC_REQUIRE(plib != NULL); |
333 | 330 | ||
334 | *plib = (struct dbll_library_obj *)cod_mgr_obj->base_lib; | 331 | *plib = (struct dbll_library_obj *)cod_mgr_obj->base_lib; |
@@ -345,7 +342,7 @@ int cod_get_base_name(struct cod_manager *cod_mgr_obj, char *sz_name, | |||
345 | int status = 0; | 342 | int status = 0; |
346 | 343 | ||
347 | DBC_REQUIRE(refs > 0); | 344 | DBC_REQUIRE(refs > 0); |
348 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 345 | DBC_REQUIRE(cod_mgr_obj); |
349 | DBC_REQUIRE(sz_name != NULL); | 346 | DBC_REQUIRE(sz_name != NULL); |
350 | 347 | ||
351 | if (usize <= COD_MAXPATHLENGTH) | 348 | if (usize <= COD_MAXPATHLENGTH) |
@@ -365,7 +362,7 @@ int cod_get_base_name(struct cod_manager *cod_mgr_obj, char *sz_name, | |||
365 | int cod_get_entry(struct cod_manager *cod_mgr_obj, u32 *entry_pt) | 362 | int cod_get_entry(struct cod_manager *cod_mgr_obj, u32 *entry_pt) |
366 | { | 363 | { |
367 | DBC_REQUIRE(refs > 0); | 364 | DBC_REQUIRE(refs > 0); |
368 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 365 | DBC_REQUIRE(cod_mgr_obj); |
369 | DBC_REQUIRE(entry_pt != NULL); | 366 | DBC_REQUIRE(entry_pt != NULL); |
370 | 367 | ||
371 | *entry_pt = cod_mgr_obj->ul_entry; | 368 | *entry_pt = cod_mgr_obj->ul_entry; |
@@ -384,7 +381,7 @@ int cod_get_loader(struct cod_manager *cod_mgr_obj, | |||
384 | int status = 0; | 381 | int status = 0; |
385 | 382 | ||
386 | DBC_REQUIRE(refs > 0); | 383 | DBC_REQUIRE(refs > 0); |
387 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 384 | DBC_REQUIRE(cod_mgr_obj); |
388 | DBC_REQUIRE(loader != NULL); | 385 | DBC_REQUIRE(loader != NULL); |
389 | 386 | ||
390 | *loader = (struct dbll_tar_obj *)cod_mgr_obj->target; | 387 | *loader = (struct dbll_tar_obj *)cod_mgr_obj->target; |
@@ -406,7 +403,7 @@ int cod_get_section(struct cod_libraryobj *lib, char *str_sect, | |||
406 | 403 | ||
407 | DBC_REQUIRE(refs > 0); | 404 | DBC_REQUIRE(refs > 0); |
408 | DBC_REQUIRE(lib != NULL); | 405 | DBC_REQUIRE(lib != NULL); |
409 | DBC_REQUIRE(IS_VALID(lib->cod_mgr)); | 406 | DBC_REQUIRE(lib->cod_mgr); |
410 | DBC_REQUIRE(str_sect != NULL); | 407 | DBC_REQUIRE(str_sect != NULL); |
411 | DBC_REQUIRE(addr != NULL); | 408 | DBC_REQUIRE(addr != NULL); |
412 | DBC_REQUIRE(len != NULL); | 409 | DBC_REQUIRE(len != NULL); |
@@ -440,7 +437,7 @@ int cod_get_sym_value(struct cod_manager *cod_mgr_obj, char *str_sym, | |||
440 | struct dbll_sym_val *dbll_sym; | 437 | struct dbll_sym_val *dbll_sym; |
441 | 438 | ||
442 | DBC_REQUIRE(refs > 0); | 439 | DBC_REQUIRE(refs > 0); |
443 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 440 | DBC_REQUIRE(cod_mgr_obj); |
444 | DBC_REQUIRE(str_sym != NULL); | 441 | DBC_REQUIRE(str_sym != NULL); |
445 | DBC_REQUIRE(pul_value != NULL); | 442 | DBC_REQUIRE(pul_value != NULL); |
446 | 443 | ||
@@ -505,7 +502,7 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[], | |||
505 | u32 i; | 502 | u32 i; |
506 | 503 | ||
507 | DBC_REQUIRE(refs > 0); | 504 | DBC_REQUIRE(refs > 0); |
508 | DBC_REQUIRE(IS_VALID(cod_mgr_obj)); | 505 | DBC_REQUIRE(cod_mgr_obj); |
509 | DBC_REQUIRE(num_argc > 0); | 506 | DBC_REQUIRE(num_argc > 0); |
510 | DBC_REQUIRE(args != NULL); | 507 | DBC_REQUIRE(args != NULL); |
511 | DBC_REQUIRE(args[0] != NULL); | 508 | DBC_REQUIRE(args[0] != NULL); |
@@ -561,7 +558,7 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path, | |||
561 | struct cod_libraryobj *lib = NULL; | 558 | struct cod_libraryobj *lib = NULL; |
562 | 559 | ||
563 | DBC_REQUIRE(refs > 0); | 560 | DBC_REQUIRE(refs > 0); |
564 | DBC_REQUIRE(IS_VALID(hmgr)); | 561 | DBC_REQUIRE(hmgr); |
565 | DBC_REQUIRE(sz_coff_path != NULL); | 562 | DBC_REQUIRE(sz_coff_path != NULL); |
566 | DBC_REQUIRE(flags == COD_NOLOAD || flags == COD_SYMB); | 563 | DBC_REQUIRE(flags == COD_NOLOAD || flags == COD_SYMB); |
567 | DBC_REQUIRE(lib_obj != NULL); | 564 | DBC_REQUIRE(lib_obj != NULL); |
@@ -598,7 +595,7 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path, | |||
598 | struct dbll_library_obj *lib; | 595 | struct dbll_library_obj *lib; |
599 | 596 | ||
600 | DBC_REQUIRE(refs > 0); | 597 | DBC_REQUIRE(refs > 0); |
601 | DBC_REQUIRE(IS_VALID(hmgr)); | 598 | DBC_REQUIRE(hmgr); |
602 | DBC_REQUIRE(sz_coff_path != NULL); | 599 | DBC_REQUIRE(sz_coff_path != NULL); |
603 | 600 | ||
604 | /* if we previously opened a base image, close it now */ | 601 | /* if we previously opened a base image, close it now */ |
@@ -636,7 +633,7 @@ int cod_read_section(struct cod_libraryobj *lib, char *str_sect, | |||
636 | 633 | ||
637 | DBC_REQUIRE(refs > 0); | 634 | DBC_REQUIRE(refs > 0); |
638 | DBC_REQUIRE(lib != NULL); | 635 | DBC_REQUIRE(lib != NULL); |
639 | DBC_REQUIRE(IS_VALID(lib->cod_mgr)); | 636 | DBC_REQUIRE(lib->cod_mgr); |
640 | DBC_REQUIRE(str_sect != NULL); | 637 | DBC_REQUIRE(str_sect != NULL); |
641 | DBC_REQUIRE(str_content != NULL); | 638 | DBC_REQUIRE(str_content != NULL); |
642 | 639 | ||