From patchwork Fri Sep 11 12:45:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 249722 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ecf:0:0:0:0 with SMTP id i15csp1631517ilk; Fri, 11 Sep 2020 05:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRK0FZ9hIDOnFiWv7v0a3bAXDiIiWnNITXcJ5BvrJ994RGcdVD3qb6ZqMm62S1gvEYyh1h X-Received: by 2002:a50:d802:: with SMTP id o2mr1893345edj.152.1599828991900; Fri, 11 Sep 2020 05:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599828991; cv=none; d=google.com; s=arc-20160816; b=hx7JCMEUQ9wJC0pJTt12JEQlTjPxX3kstqimqehSRAXxgCPNQtyx089HNX3EhCUEr2 NJ+bGfgZOO/xh2kgJZohoB438uXM+Zim92dOtFeTeCCkHwWOE8XmBsKT+JRTdxvSSX+9 JLvF5F5vu05LyF6a+GzqaSNsEemTv4Q6KYXRjKI1rOvryTWZVuag8uOmc9DnuB8gG7Hk SJ+RK33OSDHw1ulcC9Nb92YfnsNMWj+YjJUouqPR1Y4sFrw5+QiYU52rvA0hW0b+irv6 rf5hizDdK2H9DeX8zBc15s3/UB0UxIAEWuFtaGVk53arwpmV02KxEdedOtA/8gVV5dR5 Vd+Q== 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=lbLTtCynfayH2/2ifxSR2CeQXtvhYXHOMLUK6C405b0=; b=BRQZs6Rv0qvG8gh+OHi7xDH2U6SORQZpMmZcglHZTNUan6bKl5h4g2SGC6u5m8YNrk GzFiHw+T3ApZubBHYZ7ER3wNt0AGJ0DlLxoMZxrdIoQeF6QzxH6AThC/RVRpd6USKVkq BmQ5sCZmH+bOJNmuHXzvaSJw5Z/C23xFz+b5s1WGniBugNJOsLmYSiLkFBDaC+8ruvql MYmRmuvJHerDRHjgfGZv2/ra+rp5H1cp7IwuEYw/pJnWk+bhvlTpW5werfEdc82ddRH6 1j6VKKaHbpmhseCiLIqZPCZyQdFt41yH6mks69/6Lhlyx1J/B0/srBginjxYc8RmEKxj t7Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a8S4YYZw; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x23si1197590ejc.63.2020.09.11.05.56.31; Fri, 11 Sep 2020 05:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a8S4YYZw; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbgIKM4W (ORCPT + 15 others); Fri, 11 Sep 2020 08:56:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:49480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgIKMyz (ORCPT ); Fri, 11 Sep 2020 08:54:55 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 58B9D2222B; Fri, 11 Sep 2020 12:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828844; bh=751jnFFiPM7Rz+YvYy29f9LhzmeeTfNIcCziFRBD/40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a8S4YYZwBmoM16gSK3nqYYpW00eNrTiAMU7kNMNaphllIDgfu4m7Gn4zIoZc6XuLs pJOMrb2nOvIRZBMLIK5cApDWWFEuDBqnNRgJ0CLcGZ1Chy7WY0OoGld2nu/mhUE9rg ADr4MXntVtkKJEY1BxzPZinfeyI5n+b0jFIiivvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Vinod Koul , Sasha Levin Subject: [PATCH 4.4 09/62] dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling Date: Fri, 11 Sep 2020 14:45:52 +0200 Message-Id: <20200911122502.855779713@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122502.395450276@linuxfoundation.org> References: <20200911122502.395450276@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Peter Ujfalusi [ Upstream commit 5b2aa9f918f6837ae943557f8cec02c34fcf80e7 ] of_dma_xlate callback can return ERR_PTR as well NULL in case of failure. If error code is returned (not NULL) then the route should be released and the router should not be registered for the channel. Fixes: 56f13c0d9524c ("dmaengine: of_dma: Support for DMA routers") Signed-off-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20200806104928.25975-1-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/of-dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c index 1e1f2986eba8f..86c591481dfe9 100644 --- a/drivers/dma/of-dma.c +++ b/drivers/dma/of-dma.c @@ -72,12 +72,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, return NULL; chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); - if (chan) { - chan->router = ofdma->dma_router; - chan->route_data = route_data; - } else { + if (IS_ERR_OR_NULL(chan)) { ofdma->dma_router->route_free(ofdma->dma_router->dev, route_data); + } else { + chan->router = ofdma->dma_router; + chan->route_data = route_data; } /*