Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp481268ybl; Tue, 28 Jan 2020 06:37:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwmv/xZMKW8qsUKbrPVV1c8tQsEqcUJM1LEhLkPnjPyv9TUMQs4nP1mA1JvIBAYbR7gvk/E X-Received: by 2002:a9d:7490:: with SMTP id t16mr12119217otk.196.1580222264360; Tue, 28 Jan 2020 06:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222264; cv=none; d=google.com; s=arc-20160816; b=Rvi2Oyw+U6Ir3XumamoI0Qlv7RgcC62V0BYeQ0XxewEQpD4lbgyhyVJcZEyTg6zVTh 5/jPs5G1umc8RYaanyno73IRrkXkU81ZDpS/7qkaYsxV5rJAmflBjwDTV9j2kM64fNz2 w8iIc30Hc3WIWCZgsC/3D3qfPZrydXbtGpVgqhQeDABpCy6tNyjAuP//z/Zu6n2sXibf fGq+7uhB1PhDWPJhTPViZmEPkzIXY6Wd/iOzhaTjlEjg30IJFZn3zHjpY3t4/3ikjjCd 3FBOIIjsthBRTpFxYLY5BkLj2RjjeeFaoN4yFG9NNYHZItZkjH7GljlmeychoAVzfF8O dUvQ== 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=VNVdHmzdEhiPw/Tvj7mrkNb/TD1fjCwDiI8jidyWbq0=; b=C3HfTpifUPO5L1uYG2ZyaA2+jjyyiWMt2oYFHTlp9w3osTQ4nG8VXgc3aKXGJ5uRx1 hXJjnPnuyIMcYth/er5LYGzRIjbZ49Cf6E7vGtqpInPEvVETbzo8sSEf7Vwe+9Z3QXvJ o31isBh8WlzojuT9Q6R1/4r/yK9m1Ct+u/ohAtV3NXaOM7lzm/kFs3ME4ihsrE0br8+H Co6cT3qTqD1UwO3pTiMIrTBxCpvXH5Ki/K0LmutrHvhsxXB49QHOE8BFRAotbyemITEs uUeKSYOtJx11lkAyvv28jo1up3RZXYI8W+zBcJOEYi3z9jiWhBhYM+gS/pnbCkL1SuC+ Xhwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iQsIl8US; 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 d23si5039992oij.270.2020.01.28.06.37.32; Tue, 28 Jan 2020 06:37:44 -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=iQsIl8US; 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 S1731586AbgA1OW3 (ORCPT + 99 others); Tue, 28 Jan 2020 09:22:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:48208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731535AbgA1OWX (ORCPT ); Tue, 28 Jan 2020 09:22:23 -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 7EDCC24696; Tue, 28 Jan 2020 14:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221343; bh=J0Rs58nfBPI0+yMIEHA7ldizGeo8avlFhjdqUwcbVxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQsIl8US2JETlUVg1Ln973PfLH5r/52h/f57CtVWG4DUSNLCsUuJxErhFwfOu7gWI 517aE5j3a7XluHTlQGDZBxYkoXJvVXbNwE75S8rle9JV+3gH+arNMyHDGyJ3zk3dX4 DscjShzRoazqeo5fycGow8IdExDxX8VB8h8smurM= 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.9 185/271] dmaengine: dw: platform: Switch to acpi_dma_controller_register() Date: Tue, 28 Jan 2020 15:05:34 +0100 Message-Id: <20200128135906.340440053@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: 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 5bda0eb9f393f..7536fe80bc33f 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 @@ -226,6 +233,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