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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Lad Prabhakar
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 <[hidden email]>
Reviewed-by: Biju Das <[hidden email]>
---
 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