From mboxrd@z Thu Jan 1 00:00:00 1970 From: Axel Lin Date: Sat, 30 Nov 2013 11:40:11 +0800 Subject: [U-Boot] [PATCH 2/2] spi: bfin_spi6xx: Remove unnecessary test for bus and pins[bus] In-Reply-To: <1385782695.28549.2.camel@phoenix> References: <1385782695.28549.2.camel@phoenix> Message-ID: <1385782811.28549.4.camel@phoenix> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de For invalid bus number, current code returns NULL in the default case of switch-case statements. In additional, pins[bus] is always not NULL because it is the address of specific row of the two-dimensional array. Thus this patch removes these unnecessary test. Signed-off-by: Axel Lin --- drivers/spi/bfin_spi6xx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/bfin_spi6xx.c b/drivers/spi/bfin_spi6xx.c index c25c4a9..07b833d 100644 --- a/drivers/spi/bfin_spi6xx.c +++ b/drivers/spi/bfin_spi6xx.c @@ -154,10 +154,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, if (!spi_cs_is_valid(bus, cs)) return NULL; - if (bus >= ARRAY_SIZE(pins) || pins[bus] == NULL) { - debug("%s: invalid bus %u\n", __func__, bus); - return NULL; - } switch (bus) { #ifdef SPI0_REGBASE case 0: @@ -175,6 +171,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, break; #endif default: + debug("%s: invalid bus %u\n", __func__, bus); return NULL; } -- 1.8.1.2