Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp420874pxk; Fri, 11 Sep 2020 10:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5UWIiwZwR3DTIk0/P5VDjaPvIFgzrnT298B5r2hdD40jAh3GErakR3pw8nNS+sHHPnqLI X-Received: by 2002:a05:6402:3c8:: with SMTP id t8mr3197731edw.266.1599845018863; Fri, 11 Sep 2020 10:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845018; cv=none; d=google.com; s=arc-20160816; b=Bb6E/VvfWR5UpOaUTB2YOtPDWZf812SeGSxycwAIwgDhgC6Euqcn8/h/8bTJUenKx5 nYtYHHJjf68GFmlC2VjVU7PCRBr8JDDNbZrVspWYFW+9RGrynPBNZKQzRtFnwL7FmzGa T7mQA+FYain5THMt4P+EhVee+IBMOwK1dGKLSkjg6PgoUZ5hAcpin38CQvNVc+y6q76R QxpHFK4O5wIyri170LsgDUJUAOdpags6j7MrbhaeN1VbpPA0dlNy4fA5GsnzpZv3JVZc Bl/UyBUcmWzYTPHdo/xLrs2peG3LFs1PWc16/5h3815OJRQdLfxSD/xYsDq5x12PESTa UgdA== 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=//4+ifGva40X1tdbmeIhJr8oF8Ijwt0VXVzCOYiMfec=; b=lapxMz1kf5L+RorfBoEDMmdNqvXOyvgPfTMoNOyVTX447bPXG1f7B2ZxZSLExsSdq7 YrbG0FcniOA0VugjH+7jmuRbUKR7pqjBUvus4AdjEE2dPLNwn2yCLB9lzvzT7KuqBslA wliYxervIk/fn6+/CW332E4oLjg33wuBQ3yII6uH7fNpdGRj62dnco2b3WlSA9K8Xy7Y gi2Eh9XIgEgMiHY4thegl2kw9v/Kz/qTVQSR3dEWXp/d33swqpPwL3HiEFW1ZTDkH2Nd QOwr3YbbTppRt6MtKcz8wvqx4xXPRu5IgYSKiTC8LZaSN8OPvuaOTlXnXoUuHOK0iIWe FsNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YmIzWR9w; 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 m3si1541980ejk.485.2020.09.11.10.23.14; Fri, 11 Sep 2020 10:23:38 -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=YmIzWR9w; 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 S1725710AbgIKRUI (ORCPT + 99 others); Fri, 11 Sep 2020 13:20:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:52806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbgIKNCU (ORCPT ); Fri, 11 Sep 2020 09:02:20 -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 DADF62228A; Fri, 11 Sep 2020 12:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599829025; bh=Uxw6cXgBeqDxymezQx0zPIRkOo2m+9RuiWcnuHgg4IQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmIzWR9wzQgCwyg2f4QrEljyNm5oIxg62bX3u8Uzuo5qDibsQ7S0RNntBm+HOl68Z dHnAZnV+z4x7aIX/y2wcP4afVX9tTJRazQhI76HLsT4WXgZchT/tQ6ErinocqFJGE5 rVpCYba2N8gv0YRGAD+9bq6ZnBtNdjuMEe58xvCw= 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.9 09/71] dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling Date: Fri, 11 Sep 2020 14:45:53 +0200 Message-Id: <20200911122505.406607837@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@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 faae0bfe1109e..757cf48c1c5ed 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