Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp483602ybl; Tue, 28 Jan 2020 06:40:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyIkf9dFc8dmtDM5rydvBtL5s0xl7EImmM+DVFNKjPkOILHxpyTV40vBHBQs/A3jO7q0MZQ X-Received: by 2002:a05:6808:8d0:: with SMTP id k16mr3050386oij.68.1580222406369; Tue, 28 Jan 2020 06:40:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222406; cv=none; d=google.com; s=arc-20160816; b=iPIYjOCZ3NibOweRYpchnE/wic4UhceQ8X+H90L/gFbiz3pxTStOTzatoTFW+YTpX+ OLLAjWoClKsI3KYyElEPgU8ePl9AJXHAaRTHai/a8xOACFOheX59Ie1DQJ2SIIrWwzjq 0rF4OPTJshXkFr3MJsmO/WeS/l3u1qc7L3wFIAeIhfXX3TJX9ONST1ZewO9IaKk7hE2B +HbLLcvg2HZA9Lsape3lxCHzqxF77t5QLny+bTGTE8N/xZkl6asM5zwghUdUp8O6fcyU 6gk/z/dN17ZYOpDvixwzmmnR9B148TUjmpzzdG8d+dcgmb45tuW5plm3Jbp19tDTWCPw XWXg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7jWMzBuEEIxXo8P9KtOkJYisOOzuq9SMEBDwrwynsJM=; b=JrHipxaXTJkG3uHQZ9mg00NQwUvUJIguwySZOHXkAQhy8mmaRCAITdMKzsOK/g6UUt KTL0GkpzaZR9gx57c+6eEudygSBAjD08ZqmiGVA1SayLyGPljOhGW5ADlFSLZyM1vzdl SPh6kFlz86QScVdIKF0Z9yO0fNRTcbY/qCSj4DiOePVHEf/0DBTFrqYISA5bh6CQsCu6 iUqhHTFnF6yP0fm7eaurYONZHUZHpeuCIQssCnYTewecGVcEKJjApNeMYOVHZRzX5vSE wEtNHzaYH22zaCguK3zju6VaAg4ZpCwbm4vUFNm99YozDW7t1h3P1YI5MYrnhG87+e8D tmiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ci7ox8tP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h139si4740413oib.85.2020.01.28.06.39.54; Tue, 28 Jan 2020 06:40:06 -0800 (PST) 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=@kernel.org header.s=default header.b=Ci7ox8tP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730169AbgA1OTY (ORCPT + 99 others); Tue, 28 Jan 2020 09:19:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:43714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730862AbgA1OTW (ORCPT ); Tue, 28 Jan 2020 09:19:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AD742468F; Tue, 28 Jan 2020 14:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221161; bh=geLJ6xUNHRdt4519rEsGUtaXAzzPN2bxD+6kvmxJIBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ci7ox8tPP5axpMQjPX/gdRqtcDZ3eBVTgZZmq1D6qvH9FHX3zQD364tS+flzSRpr4 E5JR+YI8Fr2EYJZmVhRM7glg9qNdOQ4YArX+8mma7C/05uc3Eq0B0xTljapUhz4mXC lQvFpbAciaGwat5ODFGYd/7bhY8I5c0KUtQ4+olo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Robin Murphy , Thomas Petazzoni , Vinod Koul , Sasha Levin Subject: [PATCH 4.9 076/271] dmaengine: mv_xor: Use correct device for DMA API Date: Tue, 28 Jan 2020 15:03:45 +0100 Message-Id: <20200128135858.222551906@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy [ Upstream commit 3e5daee5ecf314da33a890fabaa2404244cd2a36 ] Using dma_dev->dev for mappings before it's assigned with the correct device is unlikely to work as expected, and with future dma-direct changes, passing a NULL device may end up crashing entirely. I don't know enough about this hardware or the mv_xor_prep_dma_interrupt() operation to implement the appropriate error-handling logic that would have revealed those dma_map_single() calls failing on arm64 for as long as the driver has been enabled there, but moving the assignment earlier will at least make the current code operate as intended. Fixes: 22843545b200 ("dma: mv_xor: Add support for DMA_INTERRUPT") Reported-by: John David Anglin Tested-by: John David Anglin Signed-off-by: Robin Murphy Acked-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/mv_xor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 23f75285a4d9c..5d524f29c5f11 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1044,6 +1044,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev, mv_chan->op_in_desc = XOR_MODE_IN_DESC; dma_dev = &mv_chan->dmadev; + dma_dev->dev = &pdev->dev; mv_chan->xordev = xordev; /* @@ -1076,7 +1077,6 @@ mv_xor_channel_add(struct mv_xor_device *xordev, dma_dev->device_free_chan_resources = mv_xor_free_chan_resources; dma_dev->device_tx_status = mv_xor_status; dma_dev->device_issue_pending = mv_xor_issue_pending; - dma_dev->dev = &pdev->dev; /* set prep routines based on capability */ if (dma_has_cap(DMA_INTERRUPT, dma_dev->cap_mask)) -- 2.20.1