Return -ENOTSUPP if bitlen cannot be handled by the controller
during xfer.

This fixes board reset when sspi command is hit with no arguments
where bitlen is passed as 0.

Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Biju Das <[email protected]>
---
 drivers/spi/renesas_rpc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/renesas_rpc_spi.c b/drivers/spi/renesas_rpc_spi.c
index 9d9e767d87..c2ff5b157c 100644
--- a/drivers/spi/renesas_rpc_spi.c
+++ b/drivers/spi/renesas_rpc_spi.c
@@ -252,7 +252,7 @@ static int rpc_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
 
        if (!priv->cmdstarted) {
                if (!wlen || rlen)
-                       BUG();
+                       return -ENOTSUPP;
 
                memcpy(priv->cmdcopy, dout, wlen);
                priv->cmdlen = wlen;
-- 
2.17.1

Reply via email to