From patchwork Sat Jun 20 00:32:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 6649901 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 06D7C9F1C1 for ; Sat, 20 Jun 2015 00:32:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61D122088D for ; Sat, 20 Jun 2015 00:32:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EB5020888 for ; Sat, 20 Jun 2015 00:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754140AbbFTAcv (ORCPT ); Fri, 19 Jun 2015 20:32:51 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:36411 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754182AbbFTAcu (ORCPT ); Fri, 19 Jun 2015 20:32:50 -0400 Received: by lbbqq2 with SMTP id qq2so80860970lbb.3 for ; Fri, 19 Jun 2015 17:32:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=P3o5RGwQm7IfBSfNhaGIrCPt7DCgPutbJv7pIx7SCYg=; b=LrFH2VfSj33AwQpZgprazxd2/QS35wZHhcuEzrTAcdgxZpOk1UsKu3VDVCZC5vF6kn dh327cYDBOdDtJmYvBzsl3glAGGszv2GFlO+6NwVYMP1v1buqcuwfecSQ6Q2/KiIURm8 +tcRrN/Au6RXP2UP3tiK1TpPZOzq8LRhLep/zKwlmr25sQI0GM9wfFlDkrO24vEdkYyi YDUO1NRi/wYZDmzwdkbuZ2JCeY8IgxGYdZxGzHmq1hG9Qexo8WfARlBWe8NFOJj7xDUE WKK7BCnw7bVeDfMFcc0++U+axdLvssdYQp14BVxBGsLi56N6ICYWI3Xrg+WIU5wwrHEF aziA== X-Gm-Message-State: ALoCoQl2rogSvffv8IHp+5cvtFUVZQ68ENDagbCfGkuhqv8Ki45qWrJ7vHHTMAOCrmFr7HfyrV/p X-Received: by 10.152.9.137 with SMTP id z9mr20246531laa.68.1434760368909; Fri, 19 Jun 2015 17:32:48 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp83-237-255-137.pppoe.mtu-net.ru. [83.237.255.137]) by mx.google.com with ESMTPSA id rl1sm1399993lac.14.2015.06.19.17.32.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jun 2015 17:32:48 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org, wg@grandegger.com, mkl@pengutronix.de, linux-can@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 1/3] rcar_can: fix IRQ check Date: Sat, 20 Jun 2015 03:32:46 +0300 Message-ID: <1788456.ArSzxG6No3@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.7 (Linux/4.0.4-202.fc21.x86_64; KDE/4.14.9; x86_64; ; ) In-Reply-To: <2010452.WyFito6egU@wasted.cogentembedded.com> References: <2010452.WyFito6egU@wasted.cogentembedded.com> MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 rcar_can_probe() regards 0 as a wrong IRQ #, despite platform_get_irq() that it calls returns negative error code in that case. This leads to the following being printed to the console when attempting to open the device: error requesting interrupt fffffffa because rcar_can_open() calls request_irq() with a negative IRQ #, and that function naturally fails with -EINVAL. Check for the negative error codes instead and propagate them upstream instead of just returning -ENODEV. Fixes: fd1159318e55 ("can: add Renesas R-Car CAN driver") Signed-off-by: Sergei Shtylyov --- drivers/net/can/rcar_can.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in Index: linux-can/drivers/net/can/rcar_can.c =================================================================== --- linux-can.orig/drivers/net/can/rcar_can.c +++ linux-can/drivers/net/can/rcar_can.c @@ -758,8 +758,9 @@ static int rcar_can_probe(struct platfor } irq = platform_get_irq(pdev, 0); - if (!irq) { + if (irq < 0) { dev_err(&pdev->dev, "No IRQ resource\n"); + err = irq; goto fail; }