From patchwork Sat Jul 15 21:43:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 9842533 X-Patchwork-Delegate: bhelgaas@google.com 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 649D860392 for ; Sat, 15 Jul 2017 21:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AED128604 for ; Sat, 15 Jul 2017 21:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FC1D28610; Sat, 15 Jul 2017 21:44:14 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 9634A28604 for ; Sat, 15 Jul 2017 21:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdGOVoM (ORCPT ); Sat, 15 Jul 2017 17:44:12 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:35238 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbdGOVoL (ORCPT ); Sat, 15 Jul 2017 17:44:11 -0400 Received: by mail-lf0-f45.google.com with SMTP id w198so1475847lff.2 for ; Sat, 15 Jul 2017 14:44:10 -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=xui9QLclzOg1cCJKQnqFkqhBmUt5DOMlFDeis9Jnn0c=; b=xUxO2zNb98D0MZ+Va9tMoXZv1GgP4NVpkQRputSJGQ7SexBeKl2k1lTxtBs5VYiilr GEQvqHeJFGsnAC9ig3pgzdpqYY/pRhLqykwF2oo+O8gCD+iFjrF6aTb8RrZHdE8Vxz36 0mJKTt3QIc3gTnq9ot8QFGPozkjcG4Y1HA+4CAD74FNExb8wJhHatafkoTxDGUsVPtWL k9Ab5zqLz0bYKWi7ZHq8fZHPMwjPlqNtiQFfx7uTsBzt/aXdEwLZQzEDQHAE3A8l822Q 1fqontyNVwvf1MUujleyQy0k2RDKvWtIjUls/5EXXv/w6CcI9O83e+02T/MEqm46xEAP RoCA== 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=xui9QLclzOg1cCJKQnqFkqhBmUt5DOMlFDeis9Jnn0c=; b=V/iiVqDh8HtuNa/4Qbno51iuNTcWl/CfYBXuGP4HDN4Vo4KcgbDdDdMtOWYhg1Jvl5 Yutsgh6Nmzk5QL/iKPA6oVZJrIDjORzmfLp+vZRKvoWGwxjsfjBhe3tjOy7YrdAnszpm GBhf0Qdb2+QDO8xLM9eTTyUqT79ipE+i4OfOoABrEX80buYiesiqG65HDVE2Z+Hrh3aH jhXXfQmE4LHpE8dCUwsDvIU5SCl5WRc0FlUr+2iIRywes6ydC0AAzLqsazgYbB4YKvL6 J++QJsz/rqaE6+6v+QddFTmoMPwZb08962zHnmlJqsyl0u4pNCdFalQUNcm5wyAkAyWL KwmQ== X-Gm-Message-State: AIVw113JnwycM3brB84MNSj6fLxhxhw1bU5jspaftjjC2uCFd5+W7ND0 raP+C4hUw3xBuDT1 X-Received: by 10.25.77.213 with SMTP id a204mr5169411lfb.121.1500155050027; Sat, 15 Jul 2017 14:44:10 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.87.148]) by smtp.gmail.com with ESMTPSA id 10sm2652754ljg.18.2017.07.15.14.44.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Jul 2017 14:44:08 -0700 (PDT) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Sun, 16 Jul 2017 00:44:06 +0300 Message-Id: <20170715214406.657273405@cogentembedded.com> User-Agent: quilt/0.64 Date: Sun, 16 Jul 2017 00:43:10 +0300 To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Linus Walleij , Sergei Shtylyov Subject: [PATCH] pci: ftpci100: fix of_irq_get() error check MIME-Version: 1.0 Content-Disposition: inline; filename=pci-ftpci100-fix-of_irq_get-error-check.patch Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_irq_get() may return a negative error number as well as 0 on failure, while the driver only checks for 0, blithely continuing with the call to irq_set_chained_handler_and_data() -- that function expects *unsigned int* so should probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed to it. The driver then probes successfully while being only partly functional... Check for 'irq <= 0' instead and propagate the negative error number to the probe method -- that will allow the deferred probing as well... Fixes: d3c68e0a7e34 ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver") Signed-off-by: Sergei Shtylyov Reviewed-by: Linus Walleij --- drivers/pci/host/pci-ftpci100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: pci/drivers/pci/host/pci-ftpci100.c =================================================================== --- pci.orig/drivers/pci/host/pci-ftpci100.c +++ pci/drivers/pci/host/pci-ftpci100.c @@ -350,9 +350,9 @@ static int faraday_pci_setup_cascaded_ir /* All PCI IRQs cascade off this one */ irq = of_irq_get(intc, 0); - if (!irq) { + if (irq <= 0) { dev_err(p->dev, "failed to get parent IRQ\n"); - return -EINVAL; + return irq ?: -EINVAL; } p->irqdomain = irq_domain_add_linear(intc, 4,