From patchwork Wed Sep 23 10:07:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 1369775 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BxDPr6D4pz9sPB for ; Wed, 23 Sep 2020 20:07:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5ACAB82355; Wed, 23 Sep 2020 12:07:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C2EEE8235A; Wed, 23 Sep 2020 12:07:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by phobos.denx.de (Postfix) with ESMTP id F012580404 for ; Wed, 23 Sep 2020 12:07:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prabhakar.mahadev-lad.rj@bp.renesas.com X-IronPort-AV: E=Sophos;i="5.77,293,1596466800"; d="scan'208";a="57729781" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 23 Sep 2020 19:07:18 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 330CF422670E; Wed, 23 Sep 2020 19:07:17 +0900 (JST) From: Lad Prabhakar To: Jagan Teki , u-boot@lists.denx.de Cc: Marek Vasut , Biju Das , Lad Prabhakar , Prabhakar Subject: [PATCH] spi: renesas_rpc_spi: Return -ENOTSUPP if bitlen cannot be handled during xfer Date: Wed, 23 Sep 2020 11:07:04 +0100 Message-Id: <20200923100704.16627-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Biju Das --- 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;