From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D0BEC433E3 for ; Wed, 22 Jul 2020 08:00:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0288420658 for ; Wed, 22 Jul 2020 08:00:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UhDReR0c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0288420658 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sntech.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IZlxDh3t+BIXArqWW5GdsKrI3GB1N7N1s7rvVwFQ4Jc=; b=UhDReR0crnTUWZNTDnoK2xfAd B22Z9pebM1lxVmMszyb8mNyo3ljk9SIYIJBL7amAO5rFRSVslZmJvPUvhPSzG3f2wMCqjFkpjnrLp t0NmBR+wAw49XRQNLK5RBbKvdrU87phiHg++8i1rG1lelaBolVQaIazYM2EhPiW3h+MJ/kiAmoKjo v50TNEZaCKJFQmdT+kvlfN1/iu5yMYs6DO+lY7vnztX7xjceHCp7UpnoJPG3fGRmUMLJWYhm0XgQU grt6vqcBBsEKokSp6OHJteOv9bqiY1AeQ86rWrm1zpBlZJWqBN8Mzp56iNMuv9fBQUjXMsOnzPJhd DDb/G9XUQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy9ea-0006I5-JE; Wed, 22 Jul 2020 07:59:04 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy9eX-0006H0-LH; Wed, 22 Jul 2020 07:59:02 +0000 Received: from ip5f5aa64a.dynamic.kabel-deutschland.de ([95.90.166.74] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jy9eR-0001l3-18; Wed, 22 Jul 2020 09:58:55 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Jon Lin Subject: Re: [PATCH v1 3/3] spi: rockchip: Fix error in SPI slave pio read Date: Wed, 22 Jul 2020 09:58:54 +0200 Message-ID: <1605191.QXBl1gRHXa@diego> In-Reply-To: <20200722065257.17943-3-jon.lin@rock-chips.com> References: <20200722065257.17943-1-jon.lin@rock-chips.com> <20200722065257.17943-3-jon.lin@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200722_035901_724230_8AF2F5DE X-CRM114-Status: GOOD ( 14.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, broonie@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jon, Am Mittwoch, 22. Juli 2020, 08:52:57 CEST schrieb Jon Lin: > The RXFLR is possible larger than rx_left in Rockchip SPI, fix it. > > Signed-off-by: Jon Lin > --- > drivers/spi/spi-rockchip.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c > index a451dacab5cf..1f5e613b67d9 100644 > --- a/drivers/spi/spi-rockchip.c > +++ b/drivers/spi/spi-rockchip.c > @@ -291,7 +291,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs) > static void rockchip_spi_pio_reader(struct rockchip_spi *rs) > { > u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR); > - u32 rx_left = rs->rx_left - words; > + u32 rx_left = rs->rx_left > words ? rs->rx_left - words : 0; I guess for future readability of the code braces might be nice, like u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0; But I stumbled onto (and fixed similarly) that issue yesterday as well, so Reviewed-by: Heiko Stuebner Heiko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel