Skip to content
Snippets Groups Projects
Commit 9bac8f77 authored by Axel Lin's avatar Axel Lin Committed by Sonic Zhang
Browse files

spi: bfin_spi6xx: Remove unnecessary test for bus and pins[bus]


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: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarScott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
parent 727cbe14
No related branches found
No related tags found
No related merge requests found
...@@ -154,10 +154,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, ...@@ -154,10 +154,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
if (!spi_cs_is_valid(bus, cs)) if (!spi_cs_is_valid(bus, cs))
return NULL; return NULL;
if (bus >= ARRAY_SIZE(pins) || pins[bus] == NULL) {
debug("%s: invalid bus %u\n", __func__, bus);
return NULL;
}
switch (bus) { switch (bus) {
#ifdef SPI0_REGBASE #ifdef SPI0_REGBASE
case 0: case 0:
...@@ -175,6 +171,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, ...@@ -175,6 +171,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
break; break;
#endif #endif
default: default:
debug("%s: invalid bus %u\n", __func__, bus);
return NULL; return NULL;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment