diff mbox series

spi: renesas_rpc_spi: Return -ENOTSUPP if bitlen cannot be handled during xfer

Message ID 20200923100704.16627-1-prabhakar.mahadev-lad.rj@bp.renesas.com
State New
Delegated to: Marek Vasut
Headers show
Series spi: renesas_rpc_spi: Return -ENOTSUPP if bitlen cannot be handled during xfer | expand

Commit Message

Lad Prabhakar Sept. 23, 2020, 10:07 a.m. UTC
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 <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/spi/renesas_rpc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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;