Invert the conditional when to exit, and fall back to common code
in the default case. This should have no functional impact on either
code path.

Signed-off-by: Marek Vasut <[email protected]>
---
Cc: Andrew Goodbody <[email protected]>
Cc: Christian Marangi <[email protected]>
Cc: Dominik Wernberger <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Venkatesh Yadav Abbarapu <[email protected]>
Cc: [email protected]
---
 drivers/spi/spi-uclass.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index a7a06312435..7a4e6d0fc5c 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -180,25 +180,22 @@ int spi_write_then_read(struct spi_slave *slave, const u8 
*opcode,
 static int spi_child_post_bind(struct udevice *dev)
 {
        struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
-       int __maybe_unused ret;
        int mode = 0;
        int value;
+       int ret;
 
        if (!dev_has_ofnode(dev))
                return 0;
 
-#if CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)
-       ret = dev_read_u32_array(dev, "reg", plat->cs, SPI_CS_CNT_MAX);
-
-       if (ret == -EOVERFLOW || ret == -FDT_ERR_BADLAYOUT) {
-               dev_read_u32(dev, "reg", &plat->cs[0]);
-       } else {
-               dev_err(dev, "has no valid 'reg' property (%d)\n", ret);
-               return ret;
+       if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) {
+               ret = dev_read_u32_array(dev, "reg", plat->cs, SPI_CS_CNT_MAX);
+               if (ret && ret != -EOVERFLOW && ret != -FDT_ERR_BADLAYOUT) {
+                       dev_err(dev, "has no valid 'reg' property (%d)\n", ret);
+                       return ret;
+               }
        }
-#else
+
        plat->cs[0] = dev_read_u32_default(dev, "reg", -1);
-#endif
 
        plat->max_hz = dev_read_u32_default(dev, "spi-max-frequency",
                                            SPI_DEFAULT_SPEED_HZ);
-- 
2.51.0

Reply via email to