Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp310813ybh; Wed, 22 Jul 2020 00:59:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt/4CaUcVw2/VZ6IAXSyoQ1fE6k8CNsSMuWx68WzfJgsqYyvlNFqjnivPqYEeNiTWOQ8Qu X-Received: by 2002:a05:6402:1687:: with SMTP id a7mr29140956edv.358.1595404778364; Wed, 22 Jul 2020 00:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595404778; cv=none; d=google.com; s=arc-20160816; b=DMwVlJuFVvl/jTo8pnaefIZTgz6Ibc+HCJ8ufBs2dPmo8XgsgvqFkpej6YnjW2zT9y rSiUOaFS1KIGjonaNO1bKyMQZj/ydAsrPEOF6lTbrXD7NrCHyx4AvKRX6vpq5w3b9YgA dYv6t04ywodWF4jRv8wm2Lo8otny635CGy73ZqkOnPNMZdIv1m8/DHp463uyLqJ+Kfyy DHFKcC3OGWMHjbY2ydMAeQ/oo34X3wkUWpETcJ207rg/5r/5w82We8AZp1OdITPzs8w4 5Qk30SuU9BfyfvTuNWsqGP6kwA+ycpdL1gxv47KcaofujSG/xWZShLM5dIjJJbaEAPVl yxzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Tb8HRj2laKNM+fdxnF/3Equr+HNdvJiUD1qRDo/zsXQ=; b=ru+R8QKpvRYFG3YuIbwkVgquHHt4afupcnWTrEj+hU4j1eBitpOlrLG996llZwWVCo sa5+3OD1moKxwmijnw+ld8H7SOSI2c0UP+E2NwDSq9gtzLfb3rSjWVNnzticL126VaOR dC4mBvQOrYR28GtUsMSCNDG8fZ/d7UtpeRx7XhSz6iIbL1pDJHQ+Wxw6UbXvYw/XivYT Ak8zICW46HE1aH2wav1CrkFjVHq24bC2uUrLkTaN0ACtT+LcrIMSwN58+hEOLmbg9o+d O6p8hj1CoLLCPXrMgcWTLLbMFuQY4jJJ007w3uNaI7YhggnIDsRPgSTgDXI8HHQ584tA 5zww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si12842047ejs.114.2020.07.22.00.59.15; Wed, 22 Jul 2020 00:59:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbgGVH7D (ORCPT + 99 others); Wed, 22 Jul 2020 03:59:03 -0400 Received: from gloria.sntech.de ([185.11.138.130]:41056 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgGVH7D (ORCPT ); Wed, 22 Jul 2020 03:59:03 -0400 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 Cc: broonie@kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org 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 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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