Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4117260pxk; Tue, 8 Sep 2020 11:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQdVhZgVsZhHJ1zHmI0q6gRLAt10TDZQatKucPpxPJueUdEfYD6ig1hWvKfo8DUPUK66hi X-Received: by 2002:a17:906:3495:: with SMTP id g21mr26325559ejb.121.1599588468923; Tue, 08 Sep 2020 11:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599588468; cv=none; d=google.com; s=arc-20160816; b=t5AJbH0v30m5ZnR6FxoEv+G0Qxc8UgOmJsqmZ5vQrySqT8pHRPE2GMc3cjv+EENC1p m7/e5la1VmhRRScddArsPHYqEybiGlljYFKbYTjoKU2hNkDEoFQd91VsykT2nfMjWYWn 6RHo4dqF7UOcwWbbne9cFzCPtjD8uE4qKZKhyMa90qnc7jjMKRVjVd8TLQ+bwk/Qvm6m 6WUu766f7PwX2Ihlafn7y8gI05PJ8zDKA9Mye0/9uhMSP93kQUZqRA2BAIw0GEydySZa VMPsQrpGB63jAp+eb8IsxasNxixZ2NtWxd6RlSS6M5TC9nbDxxI2vwb+K+j/vcdAJ2y+ sxfQ== 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=2sRoSTW/W8q9JA+gWMKT1m+yp93y10NmQfhVAv21pnY=; b=I2Rix8+9nRM46Z4dszYzCedclILyoZWcJYPYRtOiN07WwZwHHfOqSLhEcNkXpfSxzn PCxDwFXUDYgSs1ECbXCYy6nD7HnkGVQGnyQpoOd1Ut9IKqZ4a+iwMACwy1jWiu/PzG/F unZUXYRNrODWcwFQWFmEow/abaHXx2kGkF2OvByhqR/CAcp/eihQOJSC7SSkmtrSvN9j g2HewZb87K5KUC0CRI1R0md4z8bE5hEHYnM7UaIyrl/cUcAY3zVc++5+4X8MKMpvDkD6 7GQ6Gsa/XO9+uC9BWPm1RTR7rwBWpMi90fUO5aKotcG771gB11f0V6DQwBvxCOjnVjzf GTrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IKUjFZS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 j30si13353715edj.30.2020.09.08.11.07.26; Tue, 08 Sep 2020 11:07:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=IKUjFZS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1731597AbgIHSGM (ORCPT + 99 others); Tue, 8 Sep 2020 14:06:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:56672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731522AbgIHQMK (ORCPT ); Tue, 8 Sep 2020 12:12:10 -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 B7F5B2479F; Tue, 8 Sep 2020 15:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580277; bh=Fwyb9jTCNk2q2vL/vLeKnXHtiCbmQM+AyT6SO048ZTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IKUjFZS0aSBm1VbUoeyUg+pXmDr0AcDHzM9fApRIPlZGg/0XQUBt48xJXmPGlEAHy DOHnkz7o8oRcA7kKKwyHa3LTlui6fXM2KcQToQGrupOH7OHMIh6CzzIpYjzvnuwnJh D/G+69/aRtSlIZTYCFZ48ZQkUeWUNuTEZvk/MmL4= 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.14 11/65] dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling Date: Tue, 8 Sep 2020 17:25:56 +0200 Message-Id: <20200908152217.605510752@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152217.022816723@linuxfoundation.org> References: <20200908152217.022816723@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: 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(-) diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c index 91fd395c90c4c..8344a60c2131b 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; } /* -- 2.25.1