From 32dc74e9869e3f89589185ed934995d367d98b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Mon, 16 Jun 2008 21:41:17 +0000 Subject: [PATCH] [ 1984813 ] Bus driver cleanup, remove unnecessary sanity checking (Hartley Sweeten) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1284 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 16 ++++++++++++++++ jtag/src/bus/au1500.c | 4 ---- jtag/src/bus/avr32.c | 4 ---- jtag/src/bus/bcm1250.c | 3 --- jtag/src/bus/bf533_ezkit.c | 3 --- jtag/src/bus/bf533_stamp.c | 3 --- jtag/src/bus/bf537_stamp.c | 3 --- jtag/src/bus/bf548_ezkit.c | 3 --- jtag/src/bus/bf561_ezkit.c | 3 --- jtag/src/bus/ejtag.c | 3 --- jtag/src/bus/fjmem.c | 7 ------- jtag/src/bus/h7202.c | 3 --- jtag/src/bus/ixp425.c | 3 --- jtag/src/bus/jopcyc.c | 3 --- jtag/src/bus/lh7a400.c | 3 --- jtag/src/bus/mpc5200.c | 3 --- jtag/src/bus/mpc824x.c | 5 ----- jtag/src/bus/ppc405ep.c | 3 --- jtag/src/bus/ppc440gx_ebc8.c | 3 --- jtag/src/bus/prototype.c | 3 --- jtag/src/bus/pxa2x0.c | 3 --- jtag/src/bus/s3c4510x.c | 3 --- jtag/src/bus/sa1110.c | 3 --- jtag/src/bus/sh7727.c | 3 --- jtag/src/bus/sh7750r.c | 3 --- jtag/src/bus/sh7751r.c | 3 --- jtag/src/bus/sharc21065l.c | 3 --- jtag/src/bus/slsup3.c | 3 --- jtag/src/bus/tx4925.c | 3 --- jtag/src/bus/zefant-xs3.c | 3 --- jtag/src/cmd/initbus.c | 2 +- 31 files changed, 17 insertions(+), 96 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 20f100cb..69bee544 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,19 @@ +2008-06-16 Arnim Laeuger + + * src/cmd/initbus.c (cmd_initbus_run), + src/cmd/initbus.c, src/bus/bf548_ezkit.c, src/bus/fjmem.c, + src/bus/ppc405ep.c, src/bus/sh7727.c, src/bus/prototype.c, + src/bus/sa1110.c, src/bus/ppc440gx_ebc8.c, src/bus/tx4925.c, + src/bus/sh7750r.c, src/bus/pxa2x0.c, src/bus/bf533_stamp.c, + src/bus/bf533_ezkit.c, src/bus/bf537_stamp.c, src/bus/ixp425.c, + src/bus/avr32.c, src/bus/h7202.c, src/bus/zefant-xs3.c, + src/bus/mpc824x.c, src/bus/bcm1250.c, src/bus/sharc21065l.c, + src/bus/au1500.c, src/bus/lh7a400.c, src/bus/sh7751r.c, + src/bus/mpc5200.c, src/bus/jopcyc.c, src/bus/bf561_ezkit.c, + src/bus/slsup3.c, src/bus/s3c4510x.c, src/bus/ejtag.c: + [ 1984813 ] Bus driver cleanup, remove unnecessary sanity checking + (Hartley Sweeten) + 2008-06-11 Arnim Laeuger * po/fr.po, po/rw.po, po/sk.po: updated diff --git a/jtag/src/bus/au1500.c b/jtag/src/bus/au1500.c index 0a8802c8..23c44c7c 100644 --- a/jtag/src/bus/au1500.c +++ b/jtag/src/bus/au1500.c @@ -72,10 +72,6 @@ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/avr32.c b/jtag/src/bus/avr32.c index 6f8febe4..7cc68f92 100644 --- a/jtag/src/bus/avr32.c +++ b/jtag/src/bus/avr32.c @@ -487,10 +487,6 @@ avr32_bus_new (chain_t * chain, char *cmd_params[]) char *param; unsigned int mode; - if (!chain || !chain->parts || - chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - part = chain->parts->parts[chain->active_part]; param = cmd_params[2]; diff --git a/jtag/src/bus/bcm1250.c b/jtag/src/bus/bcm1250.c index c65b9850..340f7274 100644 --- a/jtag/src/bus/bcm1250.c +++ b/jtag/src/bus/bcm1250.c @@ -71,9 +71,6 @@ bcm1250_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/bf533_ezkit.c b/jtag/src/bus/bf533_ezkit.c index ba300108..89378260 100644 --- a/jtag/src/bus/bf533_ezkit.c +++ b/jtag/src/bus/bf533_ezkit.c @@ -78,9 +78,6 @@ bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/bf533_stamp.c b/jtag/src/bus/bf533_stamp.c index f8f163d1..98b9a866 100644 --- a/jtag/src/bus/bf533_stamp.c +++ b/jtag/src/bus/bf533_stamp.c @@ -78,9 +78,6 @@ bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/bf537_stamp.c b/jtag/src/bus/bf537_stamp.c index 3f86d4b2..06469823 100644 --- a/jtag/src/bus/bf537_stamp.c +++ b/jtag/src/bus/bf537_stamp.c @@ -78,9 +78,6 @@ bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/bf548_ezkit.c b/jtag/src/bus/bf548_ezkit.c index bb507483..67b11502 100644 --- a/jtag/src/bus/bf548_ezkit.c +++ b/jtag/src/bus/bf548_ezkit.c @@ -73,9 +73,6 @@ bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/bf561_ezkit.c b/jtag/src/bus/bf561_ezkit.c index 481fb41f..d927ef76 100644 --- a/jtag/src/bus/bf561_ezkit.c +++ b/jtag/src/bus/bf561_ezkit.c @@ -78,9 +78,6 @@ bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/ejtag.c b/jtag/src/bus/ejtag.c index 6d19f6af..5cd33016 100644 --- a/jtag/src/bus/ejtag.c +++ b/jtag/src/bus/ejtag.c @@ -82,9 +82,6 @@ ejtag_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/fjmem.c b/jtag/src/bus/fjmem.c index 853ee965..a93a8825 100644 --- a/jtag/src/bus/fjmem.c +++ b/jtag/src/bus/fjmem.c @@ -361,13 +361,6 @@ fjmem_bus_new( chain_t *chain, char *params[] ) int fjmem_reg_len = 0; int idx; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - - if (chain->active_part >= chain->parts->len) { - printf( _("%s: no active part\n"), "fjmem" ); - return NULL; - } part = chain->parts->parts[chain->active_part]; /* parse parameters */ diff --git a/jtag/src/bus/h7202.c b/jtag/src/bus/h7202.c index 4a546d4f..204d9b7a 100644 --- a/jtag/src/bus/h7202.c +++ b/jtag/src/bus/h7202.c @@ -68,9 +68,6 @@ h7202_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index 5589db48..783d77a7 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -68,9 +68,6 @@ ixp425_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/jopcyc.c b/jtag/src/bus/jopcyc.c index b5ba20c5..fb6165c9 100644 --- a/jtag/src/bus/jopcyc.c +++ b/jtag/src/bus/jopcyc.c @@ -145,9 +145,6 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) int failed = 0; component_t *comp; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/lh7a400.c b/jtag/src/bus/lh7a400.c index f4564ed5..9a71679b 100644 --- a/jtag/src/bus/lh7a400.c +++ b/jtag/src/bus/lh7a400.c @@ -84,9 +84,6 @@ lh7a400_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/mpc5200.c b/jtag/src/bus/mpc5200.c index 6effd750..9a09616d 100644 --- a/jtag/src/bus/mpc5200.c +++ b/jtag/src/bus/mpc5200.c @@ -73,9 +73,6 @@ mpc5200_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/mpc824x.c b/jtag/src/bus/mpc824x.c index 545028e2..20decf77 100644 --- a/jtag/src/bus/mpc824x.c +++ b/jtag/src/bus/mpc824x.c @@ -145,11 +145,6 @@ mpc824x_bus_new( chain_t *chain, char *cmd_params[] ) // REVBITS = 0; - - - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/ppc405ep.c b/jtag/src/bus/ppc405ep.c index a9a5a1d2..6a613569 100644 --- a/jtag/src/bus/ppc405ep.c +++ b/jtag/src/bus/ppc405ep.c @@ -66,9 +66,6 @@ ppc405ep_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0)) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/ppc440gx_ebc8.c b/jtag/src/bus/ppc440gx_ebc8.c index 7b8f18d4..23467981 100644 --- a/jtag/src/bus/ppc440gx_ebc8.c +++ b/jtag/src/bus/ppc440gx_ebc8.c @@ -68,9 +68,6 @@ ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0)) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/prototype.c b/jtag/src/bus/prototype.c index b7f16eea..68a323b4 100644 --- a/jtag/src/bus/prototype.c +++ b/jtag/src/bus/prototype.c @@ -102,9 +102,6 @@ prototype_bus_new( chain_t *chain, char *cmd_params[] ) int failed = 0; int ashift = -1; - if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0)) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index e7586b9f..eb18bca9 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -152,9 +152,6 @@ pxa2xx_bus_new_common(bus_t * bus) #ifdef PREPATCHNEVER bus_t *bus; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index e9e615f2..e6616437 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -113,9 +113,6 @@ s3c4510_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index 720ce9bb..16827427 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -73,9 +73,6 @@ sa1110_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index 643389c3..80852828 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -74,9 +74,6 @@ sh7727_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/sh7750r.c b/jtag/src/bus/sh7750r.c index 3657af24..2becf45b 100644 --- a/jtag/src/bus/sh7750r.c +++ b/jtag/src/bus/sh7750r.c @@ -74,9 +74,6 @@ sh7750r_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/sh7751r.c b/jtag/src/bus/sh7751r.c index 03d0b4c9..a73a42eb 100644 --- a/jtag/src/bus/sh7751r.c +++ b/jtag/src/bus/sh7751r.c @@ -72,9 +72,6 @@ sh7751r_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/sharc21065l.c b/jtag/src/bus/sharc21065l.c index 618f76cc..23bba306 100644 --- a/jtag/src/bus/sharc21065l.c +++ b/jtag/src/bus/sharc21065l.c @@ -76,9 +76,6 @@ static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/slsup3.c b/jtag/src/bus/slsup3.c index 8da456d1..ac4875c4 100644 --- a/jtag/src/bus/slsup3.c +++ b/jtag/src/bus/slsup3.c @@ -101,9 +101,6 @@ slsup3_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/tx4925.c b/jtag/src/bus/tx4925.c index ce61d9de..124e6421 100644 --- a/jtag/src/bus/tx4925.c +++ b/jtag/src/bus/tx4925.c @@ -82,9 +82,6 @@ tx4925_bus_new( chain_t *chain, char *cmd_params[] ) int i; int failed = 0; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/bus/zefant-xs3.c b/jtag/src/bus/zefant-xs3.c index 08f72001..2ef1e074 100644 --- a/jtag/src/bus/zefant-xs3.c +++ b/jtag/src/bus/zefant-xs3.c @@ -164,9 +164,6 @@ zefant_xs3_bus_new( chain_t *chain, char *cmd_params[] ) component_t *comp; int idx; - if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0) - return NULL; - bus = calloc( 1, sizeof (bus_t) ); if (!bus) return NULL; diff --git a/jtag/src/cmd/initbus.c b/jtag/src/cmd/initbus.c index 32686831..395f47a3 100644 --- a/jtag/src/cmd/initbus.c +++ b/jtag/src/cmd/initbus.c @@ -47,7 +47,7 @@ cmd_initbus_run( chain_t *chain, char *params[] ) return 1; } - if (chain->active_part >= chain->parts->len) { + if (chain->active_part >= chain->parts->len || chain->active_part < 0) { printf( _("%s: no active part\n"), "initbus" ); return 1; }