From patchwork Sun Jul 30 18:10:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 9870653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D41F3603B4 for ; Sun, 30 Jul 2017 18:11:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8EEB28539 for ; Sun, 30 Jul 2017 18:11:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDC822858E; Sun, 30 Jul 2017 18:11:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C20228575 for ; Sun, 30 Jul 2017 18:11:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754232AbdG3SK6 (ORCPT ); Sun, 30 Jul 2017 14:10:58 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:32816 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754194AbdG3SK5 (ORCPT ); Sun, 30 Jul 2017 14:10:57 -0400 Received: by mail-lf0-f42.google.com with SMTP id d17so38551277lfe.0 for ; Sun, 30 Jul 2017 11:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=JoyO9yBGmcpGIF5wxf3cXtUjSPA7e7yKC5XY9PZsW+U=; b=tiYwq2e+w7qAU4nmVUwDvYMcyJguHDv7M0ij0aZeR5s4ZcCEy8QlnLQKF6VYJBhKac MM36qE2a56gwEpzym5SX4ymOX/lehM5sxcfesE/FWrZ9tjDLvzPq7Ky8lC0QzC8swRrt l+aZuizm2IYvikL0Hctqp2QO4rMBN3ln9xla0XtmCT/Se+WiHnR+px+XCgtH6BCjDMfn 8S9l+McsrjesPRMxmcb/O9usT7WPj07dZlpcRCIGQczSG0XXHrWm5mD6n5kae4T8tTG9 aTKI2xn4XDJht3P5oUvMmPphn0/RBJLD8NeKSLrimbOs9npB40tEz0LTGDx/e0ozP6bP oK7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=JoyO9yBGmcpGIF5wxf3cXtUjSPA7e7yKC5XY9PZsW+U=; b=jcgCVMievS5lfGo8vmTsF/X8LTBbTMfGVJYmh9kPdzYvpBYK332K8Q2KZeW967Ujj2 tC1RgUpg8d+3gOVf0zfsRbrCDh5WSjN7qtyV4TUTTu5FjAgrHu99CVYb3w5fxsNzAvIw NwO05FEKNjOSO8KBwr+EKFuE/CkFo7YPGCi2h1nRTtAdw2R4/XIM1JrYFHhjrq44X3/s ZaPf0lqAaYXpOhBvtGY1WiEABZilgTFZ+sprND+m1RhTsZ4th7eN4Q6bM/qfrrR+EQgL XDT30VG/wOZmaWuWjbCd1Pb1rb+I4Hyk1g2LpAznJBTIvly3OgVtvDvH944Oa1tFbQKR CP4A== X-Gm-Message-State: AIVw110y4bFx94oU5g6u/OPaA41DNdgTL1P+MN1HxwCgYVhLH89Bac4X Vf54cImpvd0okm6C X-Received: by 10.25.74.202 with SMTP id x193mr4373858lfa.31.1501438256399; Sun, 30 Jul 2017 11:10:56 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.85.243]) by smtp.gmail.com with ESMTPSA id 189sm234394ljj.76.2017.07.30.11.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Jul 2017 11:10:55 -0700 (PDT) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Sun, 30 Jul 2017 21:10:51 +0300 Message-Id: <20170730181051.733168837@cogentembedded.com> User-Agent: quilt/0.64 Date: Sun, 30 Jul 2017 21:10:44 +0300 To: Laxman Dewangan , Jon Hunter , Vinod Koul , Thierry Reding , dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org Cc: Dan Williams , Sergei Shtylyov Subject: [PATCH] dmaengine: tegra210-adma: fix of_irq_get() error check MIME-Version: 1.0 Content-Disposition: inline; filename=dmaengine-tegra210-adma-fix-of_irq_get-error-check.patch Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_irq_get() may return 0 as well as negative error number on failure, while the driver only checks for the negative values. The driver would then call request_irq(0, ...) in tegra_adma_alloc_chan_resources() and never get valid channel interrupt. Check for 'tdc->irq <= 0' instead and return -ENXIO from the driver's probe iff of_irq_get() returned 0. Fixes: f46b195799b5 ("dmaengine: tegra-adma: Add support for Tegra210 ADMA") Signed-off-by: Sergei Shtylyov Acked-by: Thierry Reding Acked-by: Jon Hunter --- drivers/dma/tegra210-adma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: slave-dma/drivers/dma/tegra210-adma.c =================================================================== --- slave-dma.orig/drivers/dma/tegra210-adma.c +++ slave-dma/drivers/dma/tegra210-adma.c @@ -717,8 +717,8 @@ static int tegra_adma_probe(struct platf tdc->chan_addr = tdma->base_addr + ADMA_CH_REG_OFFSET(i); tdc->irq = of_irq_get(pdev->dev.of_node, i); - if (tdc->irq < 0) { - ret = tdc->irq; + if (tdc->irq <= 0) { + ret = tdc->irq ?: -ENXIO; goto irq_dispose; }