Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4130163pxk; Tue, 8 Sep 2020 11:25:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHWGupHKDh8s0aLsqGAdTAJEFpLfeqdSwLK+MFAkpz0ugSupxv9JRxD8reHJAQwWCqNNGg X-Received: by 2002:a50:f418:: with SMTP id r24mr243013edm.295.1599589545684; Tue, 08 Sep 2020 11:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599589545; cv=none; d=google.com; s=arc-20160816; b=rmR7U4c/fWHKxyyZxahNAiTiHvR96MtMskFSa4MGqb4lZ4YHOTI65aAWWBlWgZPwRq PRWBK7LgxOCfP94RwACg1ZDt1qvQeP95I+yZGx/iqvpypDFgQmxrmclIXYpzdxt8dsoj UZTWYF8yRYLh9wvHMkMvUgmbCu+VVGzFIoW54ltHt6EA8EVue9r1Hl7H2cE8A/hYQGWF 3OQTKdOArHWXw7PrzzSqvUAGmDvfx4eP42XACJIm9/yM7OeMIRn88Nf0nSw6gN5xdbH+ hwT0c0lQTyOGu3bCr+6RsFKjYiOyK3CLJefkC4e3JXPKD1neKyoXFDRVJ5H+ofGjy6Wb yKpA== 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=80flr+dOplB/U4LdyREhYdrFxMg/2EIZROv31X315ww=; b=L/o2r6/JCR//1cBVYevPljXzkCD07kHYDQdznYNhYTF8Nf55igE5y6ah7Xv2AJ2YIl 35r0DHrVbVUI/d/h5u1ePLWBDZ+Cyh760g4auKb+mXW4UCxYr5ZB1mZKmve9FNW+Uale ZkHZn0NzvMbRZu3Calx4EAg1nmOdtSd8s2zj370ZuZeJ36TDAbL1AL0rwgSNsWpYYkDv bzMUuiJf5TKG4LVz/bKlO6q7CtFoQSi4x8VkSNPzdK0rqfmFeCyREIbOw5lf2Ke7OowD mr+m+ZAQArRZ1bnsPWoWQCmsFHHMVe9g+3MqAi5xyPeLNkWD1I7T73azxNHILjzBT/16 k/ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ywErtKgh; 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 x9si12131220edv.540.2020.09.08.11.25.22; Tue, 08 Sep 2020 11:25:45 -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=ywErtKgh; 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 S1729298AbgIHSVw (ORCPT + 99 others); Tue, 8 Sep 2020 14:21:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731466AbgIHQLL (ORCPT ); Tue, 8 Sep 2020 12:11:11 -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 59251247E6; Tue, 8 Sep 2020 15:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579756; bh=u/PWZb7114iK1yOzgf7Cmth9CCerX2WYzrhq1M1BPqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywErtKghSksULK11KWhR5ggbjJ8m/a8fvCyDfd54rG4ty2WOO7FngXE1Ki1uFss/y 5dXwV8QEn/HqvrRlfjL6mRATJ1I8hGEjxwxihpuaqd7/hcsQLcPibB/j2dpUiRP5EN llEjcfHG5j8TaU2c5OtejDPu1gWtu/FBY3BEzE+8= 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 5.4 022/129] dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling Date: Tue, 8 Sep 2020 17:24:23 +0200 Message-Id: <20200908152230.812631778@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@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 c2d779daa4b51..4bbf4172b9bf9 100644 --- a/drivers/dma/of-dma.c +++ b/drivers/dma/of-dma.c @@ -69,12 +69,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