From patchwork Fri Nov 14 22:21:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5309931 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 37B889F2ED for ; Fri, 14 Nov 2014 22:22:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6367E20149 for ; Fri, 14 Nov 2014 22:22:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C9D22015D for ; Fri, 14 Nov 2014 22:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422804AbaKNWV5 (ORCPT ); Fri, 14 Nov 2014 17:21:57 -0500 Received: from mail-ig0-f174.google.com ([209.85.213.174]:55401 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161942AbaKNWV4 (ORCPT ); Fri, 14 Nov 2014 17:21:56 -0500 Received: by mail-ig0-f174.google.com with SMTP id hn18so528209igb.1 for ; Fri, 14 Nov 2014 14:21:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=uV0TGXRBI4jkXX0jOjFxFr8CjUJBgu3erEiy7wKXVIU=; b=A72vl/ZvRdbk79vbkNo2dhVhMy5+ehkFAQ4rhj4GNK/fUBnwRRoiJYRa1pUKksEBgT fv59Fzbo5AVkcJ2ZfYOFwP41it0WMCJHvT72lyzM7h8NO287hT+Xnw2lmwPoOjPgFB8h j4yWhMEkbhm7TAFSOQha++46Tebh6/PTuz2nj3ptbU1xT0JexoUMjCU7xnZvLIIBSJxR cYAe6/W4IPNzV8IDN1/qvzlsp8TlX5rXw9+4iJ0qmT3zutlQFFsE/O5GvAWAls2xGJIR 7mIwk3h9Eb04KCqQzHPIgSmJ65BEYfMjNLcxr24tCpL2yoZ8RSfNZL26CR5NEBVAS7oY 78sg== X-Gm-Message-State: ALoCoQm0BagJez1OCGzNSYP9UIWy6RnfIXmFdvLAp8O7nxtngLfDIXExoLpOAcZnc/1WhtJQQcSB X-Received: by 10.107.165.19 with SMTP id o19mr13410553ioe.1.1416003715549; Fri, 14 Nov 2014 14:21:55 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:8c0e:c406:dbcd:b83b]) by mx.google.com with ESMTPSA id p137sm12718789ioe.13.2014.11.14.14.21.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Nov 2014 14:21:55 -0800 (PST) Date: Fri, 14 Nov 2014 14:21:53 -0800 From: Dmitry Torokhov To: Simon Horman Cc: Bjorn Helgaas , Phil Edworthy , linux-pci@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: rcar: fix error handling of irq_of_parse_and_map Message-ID: <20141114222153.GA39494@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return value of irq_of_parse_and_map() is unsigned int, with 0 indicating failure, so testing for negative result never works. Signed-off-by: Dmitry Torokhov Acked-by: Phil Edworthy --- Not tested, found by casual code inspection. drivers/pci/host/pcie-rcar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 9b356c3..6ca976f 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -764,7 +764,7 @@ static int rcar_pcie_get_resources(struct platform_device *pdev, goto err_map_reg; i = irq_of_parse_and_map(pdev->dev.of_node, 0); - if (i < 0) { + if (!i) { dev_err(pcie->dev, "cannot get platform resources for msi interrupt\n"); err = -ENOENT; goto err_map_reg; @@ -772,7 +772,7 @@ static int rcar_pcie_get_resources(struct platform_device *pdev, pcie->msi.irq1 = i; i = irq_of_parse_and_map(pdev->dev.of_node, 1); - if (i < 0) { + if (!i) { dev_err(pcie->dev, "cannot get platform resources for msi interrupt\n"); err = -ENOENT; goto err_map_reg;