Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp453008ybl; Tue, 28 Jan 2020 06:13:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxyrI7fLbeyAcNPZ4QAM9EOqCG1r0xVH0q+QoncA1J9/6JAuY4tPXSvydZZF4DApdYsgIiq X-Received: by 2002:a9d:6b8a:: with SMTP id b10mr16951146otq.322.1580220801937; Tue, 28 Jan 2020 06:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580220801; cv=none; d=google.com; s=arc-20160816; b=U+9Rl4z4ycof+tGbLRokI7iXFKzhpbCmzVfKPzE82N0SZyVMge5sKlinT4MWL7+Swx eEG4f1wzNSaQtW3HiFewXWpRa/4/AaKB9cpUyqBKe+JCPhTdjpUOHJq/Zj8uRys3p6qJ 9YeGN2i2uKhw/kbb/nBppleX2z/WRlHXe7xbYcPGl2PYGMKEdi6lK1G2HFhg1Ozfg1Ju fMCM3ABQbEJyCW8UF2fBMNfi994ArQHcPGvqK3O++Z1W80iGBOdprLUrX/iVDxqf8m1n QmDuhupRdTW6TrwouYqdD96Ua/B+FtICENPBGMXVb6GSqZt8INBb0akLWyR3IEdHhZfM i0Xw== 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=1Q8i51lQqhZBeDvy560da9+6tIwY4J2iY2oRv6eWUU8=; b=0a5m7eREwe106Ks+rKKgZE0Z3drEfqr/HJIH1Pv5Jt3t8c2uzuCA0eoW+H5wJtiX3M XcBg6RyMp5BNvyO60ZZltJxImS/Ln7RG8hpK21nu0aoFa2cGKNPL+3Oyakzz8Maf7+6P oY7UuBxljRXi28aSvzGRTp/t1DVWKmxIsRrUx5dBY85z5xOGoQGJeqXlqsHAZnQDYJqM p4lJlDTctB1yXA7XSjw0Lb6NXoi0P2ew1ZAeU78t6GiIA+e7w+J/9cdKlVG6zKLhxufp RMepOlGym2yG6MRqZJBDuYf0J3gs+lVllTfDMZUr0Sdj+VZU+I3QQ2xW/0aq5CyiTU0a cgnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zue7+O71; 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 f14si9471684otf.178.2020.01.28.06.13.08; Tue, 28 Jan 2020 06:13:21 -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=Zue7+O71; 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 S1729429AbgA1OML (ORCPT + 99 others); Tue, 28 Jan 2020 09:12:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:33302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729418AbgA1OMJ (ORCPT ); Tue, 28 Jan 2020 09:12:09 -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 6553124688; Tue, 28 Jan 2020 14:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220728; bh=mTwtuZvVxps8eIkJHJpDXzBUnlJ1jEz84g0HQIu4pU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zue7+O71TlppKPzz5tIex0k7uqKEbilvcy3Xeia50Z7Bbc8xKy7aIKuxRLdibVCPX lXheGTLi3dyHLrs/ugHU8C3QawvY34ZalVDSxX86OEdtIh4EKHrHTJztQM40RQu3sS vVfkJTL9yla4BWNbVQqKAuNpPRPwjfD96lGxPhmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Vinod Koul , Sasha Levin Subject: [PATCH 4.4 124/183] dmaengine: dw: platform: Switch to acpi_dma_controller_register() Date: Tue, 28 Jan 2020 15:05:43 +0100 Message-Id: <20200128135842.295272635@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135829.486060649@linuxfoundation.org> References: <20200128135829.486060649@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: Andy Shevchenko [ Upstream commit e7b8514e4d68bec21fc6385fa0a66797ddc34ac9 ] There is a possibility to have registered ACPI DMA controller while it has been gone already. To avoid the potential crash, move to non-managed acpi_dma_controller_register(). Fixes: 42c91ee71d6d ("dw_dmac: add ACPI support") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20190820131546.75744-8-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw/platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 68a4815750b51..22d0cc1855b5f 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -87,13 +87,20 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw) dma_cap_set(DMA_SLAVE, info->dma_cap); info->filter_fn = dw_dma_acpi_filter; - ret = devm_acpi_dma_controller_register(dev, acpi_dma_simple_xlate, - info); + ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info); if (ret) dev_err(dev, "could not register acpi_dma_controller\n"); } + +static void dw_dma_acpi_controller_free(struct dw_dma *dw) +{ + struct device *dev = dw->dma.dev; + + acpi_dma_controller_free(dev); +} #else /* !CONFIG_ACPI */ static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {} +static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {} #endif /* !CONFIG_ACPI */ #ifdef CONFIG_OF @@ -225,6 +232,9 @@ static int dw_remove(struct platform_device *pdev) { struct dw_dma_chip *chip = platform_get_drvdata(pdev); + if (ACPI_HANDLE(&pdev->dev)) + dw_dma_acpi_controller_free(chip->dw); + if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); -- 2.20.1