Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp749830ima; Wed, 24 Oct 2018 08:38:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5fm0cpiunrfVgzvFLJvEbWGF/KibpY0Yuytn7Eij6eJYJzuqKV81OofWEITeNfttJnETowt X-Received: by 2002:a65:664e:: with SMTP id z14-v6mr2871074pgv.347.1540395505343; Wed, 24 Oct 2018 08:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540395505; cv=none; d=google.com; s=arc-20160816; b=yrVhwSH3NarfOJzYGLjfSIr/vyBWMrKWO77gYZlOyi3ltkSkuZ8LbXdzfyl4xwB0pZ qRcYlUVUFwAdDFsAOWzeWY0JsLdbeyxsBRmOSIY7yb4b704mfwsYDQWu/pshMCcWqrII C8Huu50lt5qde2HDcBmCmKDJpKyg6nX39XWvFrrRTWKsGP62FaTgOghRFO5L1EBClbIt 6rv9PM1/1dMhVTtSbrLfF7Ymqy5MYsD89nVJY8TQpQP6Ap6X/oAo3lzPcggdqU+/1/Zl JrOptQWhJotgA23i+g127lGfcAojf52cu9mGaaHz0eo4LcV0dfMGc6Wep6Ved+OkVODa 61WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Iq14mvPfPo0QV8UWdjTypdYY45acRuUN2qXbiQi55jU=; b=tCqSq15vJrmDT1tA0rJvfojvmrkxTvx4TbpXetIZcOC7dmHVrG049woL8aqfXA6tv6 NT80V9j7qehjWygBqa1ty7cGyYaVDais/wr+ymy57BcIhzeapoGsAxLb+930w983Yi/M 4YoNA3CqxSB1XwrqBGMmWMv4koqGeJ9QITZgCn9USQ9Dr1KOuJSmXdAgJyWwh5OL89py fx8ULUp+QDr4PGvIySmAyGxxEjGR3BMjMtnHPlrLj3ZcTjYYn/E7Q0k7cMo5OTPZ7+6+ 0ACBt9JW5bZUhnQWQUHLSW95amHzygxf6n8A1ZNnyD2Gl2csecxJIGrFcxSfFJhbccXO auAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=REeRlbuE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17-v6si5154883pfe.187.2018.10.24.08.38.07; Wed, 24 Oct 2018 08:38:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=REeRlbuE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbeJYAGS (ORCPT + 99 others); Wed, 24 Oct 2018 20:06:18 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:44310 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbeJYAGS (ORCPT ); Wed, 24 Oct 2018 20:06:18 -0400 Received: by mail-pf1-f195.google.com with SMTP id r9-v6so2592413pff.11; Wed, 24 Oct 2018 08:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Iq14mvPfPo0QV8UWdjTypdYY45acRuUN2qXbiQi55jU=; b=REeRlbuEJk+wP1NdxobfSnj2102uNGy6ecjH8I1un4Sgi4H94XGRp0TVFuDwrQttij pqkkOFz+pXkxS8VDq72XQuaopLnF4ao/uXOIkua9lyoQA1CpAMVRsSaVbU7j9RK4BBZV TS7dkDXvX69Dz8/EOnMxfU7zezdrrniUqBNTjR4mIeAyWojNlS2+L9rx0vOfaUTOQxEi 5pTN++Q09taaFI3AVlARrxAQMmypACUkGaNuWNgZJ4an3Kzl4ySRT7gdGCkDNZjJ2vWd qHuxfo1SJnSQ77QjPV6MHrS9//Vx1TUYBDEoS239WsBlAl1vZKZepM4XHKd7G6k+qcmI yhzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Iq14mvPfPo0QV8UWdjTypdYY45acRuUN2qXbiQi55jU=; b=VOWmOPge9bFcb9XHRZbXpkUgaBzUJjLxdmiI2OUMzGP2elOktRe2kXm+xTXJFcHVRB umY5Nqs/3G2qPFQYSKJk+1oYMWvwsezg8j7B97hRKIQBd/pKgSJUDG+r44CzLeFDj0ND 1DQPNtxGg0jr+UPUZQjlWFqXDI+Zz4mpGVssuN68ft5Qj0QMqUN99tfCK7Cm62XqOWiO m1Q0Qy7AqKPW39ZQW/svaRSisSJHGSQLLM2lyXzKKlGzTx4dUqrmMvuDQG/q0m5Z2pIa zaklQWiso2WOcT3SKKCAAHr3GtI+abRhjF8t1gaLQlNY5XCDHFjw94JNPMMIDtrZieNk x/uA== X-Gm-Message-State: AGRZ1gKHhrWLc5bsGqV3alU8UjdPO9B739lKMGkXlLKax1gppqosIkP8 S82uy8JQ6Yvuha2PHVf7E2c= X-Received: by 2002:a63:db04:: with SMTP id e4-v6mr3017772pgg.280.1540395464015; Wed, 24 Oct 2018 08:37:44 -0700 (PDT) Received: from localhost.localdomain ([49.171.224.30]) by smtp.gmail.com with ESMTPSA id d29-v6sm5494826pgm.56.2018.10.24.08.37.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Oct 2018 08:37:42 -0700 (PDT) From: Jaewon Kim X-Google-Original-From: Jaewon Kim To: Mark Brown , Jaewon Kim Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: dw: fix buffer end address Date: Thu, 25 Oct 2018 00:37:17 +0900 Message-Id: <1540395437-6623-1-git-send-email-jaewon02.kim@samsung.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Buffer address can be NULL, if user does not want to receive TX/RX data. In this case, driver should not set the rx/tx_end value with len. Signed-off-by: Jaewon Kim --- drivers/spi/spi-dw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index b705f2b..34e6fca 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -293,9 +293,13 @@ static int dw_spi_transfer_one(struct spi_controller *master, dws->dma_mapped = 0; dws->tx = (void *)transfer->tx_buf; - dws->tx_end = dws->tx + transfer->len; + dws->tx_end = dws->tx; + if (dws->tx) + dws->tx_end += transfer->len; dws->rx = transfer->rx_buf; - dws->rx_end = dws->rx + transfer->len; + dws->rx_end = dws->rx; + if (dws->rx) + dws->rx_end += transfer->len; dws->len = transfer->len; spi_enable_chip(dws, 0); -- 2.7.4