Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp22133ybh; Tue, 17 Mar 2020 17:20:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvpUEHeWdQFtD4tuH/1D8SMsraJg3jfbFngKZK9fP0f2DwcQSIUwdOxHbkjroN9He4xUbT6 X-Received: by 2002:a9d:6a91:: with SMTP id l17mr1726314otq.29.1584490818982; Tue, 17 Mar 2020 17:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584490818; cv=none; d=google.com; s=arc-20160816; b=Ru1FmT+wMj13lifOZgqv/A9ms6FXlWeDBMRhk+NCPVqZwxnRIwb4Jrlqqd5W19BEd2 rGMyh0kWCoUFTm7XUYk2X7vqqSZwaeJrYMjSR+UKEFQZHhxG4z6gXEzZpYyObPEubvxh GMdh11d2zKekCNrXi+szvMarCX7qOscm1/Ee8mqJNwCOOQKmr7bzhGuSv9kO2NZDZdtG eZNZ1Zy7SFp5F7uNFJwTfjV2RvxV5gR8yogxrAD8oqiQsR0LngIqznZdUTdaFNkuKNL/ zNKDso9dmdFMwHXZmz+PNkHmIQB1WwagcmIhASHySwDqhTe9PTOaewMJ0AovCDMd5VoX BQUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=do7ELkqPnkaQdQSXxeirNxxb2K6EQjDuUS0MOsNqAx0=; b=o67rOT19/Ul9GCnfLnGIOt3HDCvLiH7uzwJFgHZnSoEYBxEetuRyZgNKzAYAvQ3Q7M 88m8tg8gQMAGSS+DEXuj44PWOpW0zruYLTKFHob8QVkJxP41ayNYpjCz7ESWPiAucbkc 52YM51LaNoP7Y8oLSJlV5OpY+xxEF8lbNHvD+WteWFlQ/LX9k1CJQxL4fTR8pKTciIAO YaExhwRvwWX0Nk4D6uJfCJpoxbBjaKQtkdvcv91lo7DvMu1rB0xMY89CSf7roYGgpMuj 0pj2V3d3WzktAsJNzO0jcJNcfogHH//ezFLrIYiI8BhBJ+aPQy+0bWrzPohRQHGPvR4t H88w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nF80gTQe; 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 h25si2452960otq.53.2020.03.17.17.19.57; Tue, 17 Mar 2020 17:20:18 -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=nF80gTQe; 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 S1727372AbgCRARZ (ORCPT + 99 others); Tue, 17 Mar 2020 20:17:25 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42913 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727297AbgCRARS (ORCPT ); Tue, 17 Mar 2020 20:17:18 -0400 Received: by mail-wr1-f68.google.com with SMTP id v11so28140554wrm.9; Tue, 17 Mar 2020 17:17:17 -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:in-reply-to:references; bh=do7ELkqPnkaQdQSXxeirNxxb2K6EQjDuUS0MOsNqAx0=; b=nF80gTQePFcG6c8yIYXVht24MAiuD6AdREzl1+Co6qjbvmpJhY5B/bXdWORSmaLc8J /XwYdjJuVVYuYhc0ZrBRHWJxv0efsOj/HMeN/NUyGi0FDeDbClfGNNawBOYxBrCZu/ZZ t876/49RrpHuhtZIbCb3y+PsmO25U0zxv5EfS9Jz8WifFxXdBLcbqIo9IpnhpP+vkBkh UU9h280KDbmDiajlwBEVnvsxqaHfHBnWSNsmuZ5YULONIjCJJQbroUXaPJ77Dzq3lRM2 TiEtVmIri5A66vcUTarwwVbCBATretv4Ji6Gd2wa9W7yTxln1/MX2OVUagwrvrEEn9m/ YI/g== 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:in-reply-to :references; bh=do7ELkqPnkaQdQSXxeirNxxb2K6EQjDuUS0MOsNqAx0=; b=NyjUWyRqt85R4KopTw+x79Au45sUC2GiGfq1yL5QXLjA7rW2SKvZmhJ5iQEow9kqc9 HQSUi6V5389EXFGNseNypD9f/dNNOl+6ikNtK5BSeT8zk5R0sKohwlIVurDuZG7bmsMt d35qOopHNPkjAws+ONNJwsdl+SG/t+STMaF+xmPfsgWlmScJkUOX3W/54anyglpasOMa Bck+Xv4N5zy+pFH4AqCLwC2Z7lzYLn3HlU0ZXhwLPO4k2AH4z5W9n5zWJNWHDnYFL61b VT+Uv9PyObHX6u5wlsMp3Vp4cRx3IVZywK7HXjk16DC1d3Af/PlJbgWjKliOvO/clmhL NMbg== X-Gm-Message-State: ANhLgQ3ZsZBecH3xo+k/wqxnWS4KHiWeld8/Olmzh2mUtsFAZu/l0Cbh cXe/VkFS70aW5Mp9Rm1XsVw= X-Received: by 2002:adf:97d5:: with SMTP id t21mr1542972wrb.45.1584490636460; Tue, 17 Mar 2020 17:17:16 -0700 (PDT) Received: from localhost.localdomain ([79.115.60.40]) by smtp.gmail.com with ESMTPSA id i6sm6584600wru.40.2020.03.17.17.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 17:17:15 -0700 (PDT) From: Vladimir Oltean To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, eha@deif.com, angelo@sysam.it, andrew.smirnov@gmail.com, gustavo@embeddedor.com, weic@nvidia.com, mhosny@nvidia.com, michael@walle.cc, peng.ma@nxp.com Subject: [PATCH v5 07/12] spi: spi-fsl-dspi: Avoid NULL pointer in dspi_slave_abort for non-DMA mode Date: Wed, 18 Mar 2020 02:15:58 +0200 Message-Id: <20200318001603.9650-8-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318001603.9650-1-olteanv@gmail.com> References: <20200318001603.9650-1-olteanv@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean The driver does not create the dspi->dma structure unless operating in DSPI_DMA_MODE, so it makes sense to check for that. Fixes: f4b323905d8b ("spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver") Signed-off-by: Vladimir Oltean --- Changes in v5: None. Changes in v4: Patch is new. drivers/spi/spi-fsl-dspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index b65c21d048f9..81e22b6eadc7 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1192,8 +1192,10 @@ static int dspi_slave_abort(struct spi_master *master) * Terminate all pending DMA transactions for the SPI working * in SLAVE mode. */ - dmaengine_terminate_sync(dspi->dma->chan_rx); - dmaengine_terminate_sync(dspi->dma->chan_tx); + if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { + dmaengine_terminate_sync(dspi->dma->chan_rx); + dmaengine_terminate_sync(dspi->dma->chan_tx); + } /* Clear the internal DSPI RX and TX FIFO buffers */ regmap_update_bits(dspi->regmap, SPI_MCR, -- 2.17.1