Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp461589ybh; Wed, 22 Jul 2020 05:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGkprDj6wMICgcnsHooozsNJ1H8OG6EFznIBAEfStuZce3dU/DHRp9AWRlFdMZCOWNKRAy X-Received: by 2002:a17:906:b74e:: with SMTP id fx14mr751586ejb.202.1595419922745; Wed, 22 Jul 2020 05:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595419922; cv=none; d=google.com; s=arc-20160816; b=0rdrmGaYRGS6xIp/9Lp8MfTKNeLLdJaD+6bb+X0w2F5104IplU81A73TvKs6RmCtha ijBp5TYys4l3R5v46O/lyp8J/DJJGZWvkGQfgn5OfN8v5iJh3WI685n/LN67JACYDOMU rzbanqCWV/oRypSAHuPmByFn90M5WLGc3CzCGqlnofhhTnkGCaf03WnSPqjDdw29zxQ2 ehX0yEpBJmYkWH6uitorqKlzxj12ek1jvT2XpoipN1KN+xvKsOeBdS16yYumVOshrsYj YO5cMFfwA9Unn5PXFjqnaxkYQRQwjsqyKf/s0obl6kKXefLxlgTX19b4tFBSeBZL+Rwd LOUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=QSzoFOHUVmdm4+hpeLW9BMuGWntrq3KBdAl5nKJE4ps=; b=jZ0Wu9JZRVoXzGxECA0p3f7ftfntXwCeqMGWNExSft5gfRYhKkfWxEOBmAaKq9B429 VDUrkczZB20dXXLkWXa3MGxLWKoNBP7BXwIHPSuKZF16bkxDDqSaHUdY15hbgyMoZEHn l/8dP4UR4ZrXgEzfJnoh2UG8wveifq2d8b73Pj9hxVB/gmXVsWDI3O0ptrLBAON9wWDF hYZt8YY9180/pSBIPM+3BArszZbyfEMICWq3wHQ1ruvqVex8Ad7EtBiSWSR44/Y+0Gry O162BIH5Ye9Yd4bPo0O1ql6hAzV5Vyg0oJ28hLbIvGfn/2yCwjE93qQaqM5iPYyQAxf9 jQOg== 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 h21si14356983ejb.246.2020.07.22.05.11.28; Wed, 22 Jul 2020 05:12:02 -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 S1732161AbgGVMLQ (ORCPT + 99 others); Wed, 22 Jul 2020 08:11:16 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:33697 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbgGVMLQ (ORCPT ); Wed, 22 Jul 2020 08:11:16 -0400 Received: by mail-yb1-f195.google.com with SMTP id c14so910528ybj.0; Wed, 22 Jul 2020 05:11:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QSzoFOHUVmdm4+hpeLW9BMuGWntrq3KBdAl5nKJE4ps=; b=p70+BdQS656XB/0BOEw8ZSckiChqzR6wdEVDwCR43rt4J8WrA9BtQQR/aDyZO4kpGB 3lsddM4Y6/kwSdGBiIpPljbGpJN9KrxFFLiXfO+s4GRVeV03XmrEfdWpdwPg2cXcBkqO +1Q9LXLQulKEepQgJ1n9LHa4bkTjCMTMjQ/RyNXyPmH87mVgLQXgB+SDOSW93WluR8uj NnCCYPPtCm0jCNfq8DmVG4KzhZxt7wP47G06kjVti1DcWwNpsxy40UxF1Cw9GIveSpsU +t0tRPzM4bE6BunctVCKxz7rJZ0WPnuLRlD12velWaX89NcWKX11ujXwH6VzppAsblML KzbQ== X-Gm-Message-State: AOAM533sfKniqJ4FR3PHSWRAFLW4XO59VlPOHGsjzJANUAUKcxLRScux SiRAp5xzTrqaV6azgWcYuzNX4EUVxXC619+z2IvRItLcJEA= X-Received: by 2002:a25:bc13:: with SMTP id i19mr46664332ybh.391.1595419874918; Wed, 22 Jul 2020 05:11:14 -0700 (PDT) MIME-Version: 1.0 References: <20200722083737.8820-1-jon.lin@rock-chips.com> <20200722083737.8820-3-jon.lin@rock-chips.com> In-Reply-To: <20200722083737.8820-3-jon.lin@rock-chips.com> From: Emil Renner Berthing Date: Wed, 22 Jul 2020 14:11:03 +0200 Message-ID: Subject: Re: [PATCH v2 3/3] spi: rockchip: Fix error in SPI slave pio read To: Jon Lin Cc: Mark Brown , Heiko Stuebner , Linux Kernel Mailing List , linux-spi@vger.kernel.org, "open list:ARM/Rockchip SoC..." , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Jul 2020 at 10:38, Jon Lin wrote: > > The RXFLR is possible larger than rx_left in Rockchip SPI, fix it. > > Signed-off-by: Jon Lin > Reviewed-by: Heiko Stuebner In addition to my review and test you should probably also add Fixes: 01b59ce5dac8 ("spi: rockchip: use irq rather than polling") ..so this will be picked up in the stable trees /Emil > --- > 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..75a8a9428ff8 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; > > /* the hardware doesn't allow us to change fifo threshold > * level while spi is enabled, so instead make sure to leave > -- > 2.17.1 > > > > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip