From patchwork Fri Nov 14 22:29:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5309971 Return-Path: X-Original-To: patchwork-linux-wireless@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 86CC19F667 for ; Fri, 14 Nov 2014 22:29:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7C562015D for ; Fri, 14 Nov 2014 22:29:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0262C20149 for ; Fri, 14 Nov 2014 22:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161920AbaKNW33 (ORCPT ); Fri, 14 Nov 2014 17:29:29 -0500 Received: from mail-ig0-f175.google.com ([209.85.213.175]:55375 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754568AbaKNW32 (ORCPT ); Fri, 14 Nov 2014 17:29:28 -0500 Received: by mail-ig0-f175.google.com with SMTP id h15so522484igd.8 for ; Fri, 14 Nov 2014 14:29:27 -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=ktf1S7rRfIRLt3VsGEE70IodJjgEZEOwVDiJM9QM7nY=; b=dxIWbWY159L0oVja3C62YPz8Wy9A/v+QeBtlasgr/V6NgrebOYjWPAPWjKf5qbq7Jr YoEIOrlonI8bkdPkbo5seeiWFD5g9C8Lg8qx3+D3QjjD9VWitqk9y0h9GkJ9YKxZwTHP 9aViFsCIAOZbUb0q59q8cZU46yPiArVy9AJpSV60cvypFYyEv3Fb/cCWMLefU0t2fjYz LYDugMAU7z58mWZzyU8+Wp7VSuUNqHb1OllxzBWTeXo/ilHcXhWK/4ue1drOVbpWX0iw /h/kVZhHGx76oEZi4WuGJ6hRvecdfPL13cE6GIfXHGaHlFCxSg+YWatRJeNXFzGtJrVz OWKA== X-Gm-Message-State: ALoCoQmzDALfy9azY4Gz/L88KtEIW67lzNSdqv78H1V9r++VbkJpZk/adTaTvBlKWphJSoF+R/j4 X-Received: by 10.43.1.70 with SMTP id np6mr13785358icb.39.1416004167676; Fri, 14 Nov 2014 14:29:27 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:8c0e:c406:dbcd:b83b]) by mx.google.com with ESMTPSA id u65sm15014076ioe.14.2014.11.14.14.29.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Nov 2014 14:29:27 -0800 (PST) Date: Fri, 14 Nov 2014 14:29:25 -0800 From: Dmitry Torokhov To: Lauro Ramos Venancio Cc: Aloisio Almeida Jr , Samuel Ortiz , Clement Perrochaud , Arron Wang , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] NFC: pn544: i2c: fix error handling of irq_of_parse_and_map Message-ID: <20141114222925.GA334@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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=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 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 --- Not tested, found by casual code inspection. drivers/nfc/pn544/i2c.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 440291a..cfb3f0b 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -918,13 +918,12 @@ static int pn544_hci_i2c_of_request_resources(struct i2c_client *client) } /* IRQ */ - ret = irq_of_parse_and_map(pp, 0); - if (ret < 0) { - nfc_err(&client->dev, - "Unable to get irq, error: %d\n", ret); + client->irq = irq_of_parse_and_map(pp, 0); + if (!client->irq) { + nfc_err(&client->dev, "Unable to get irq\n"); + ret = -EINVAL; goto err_gpio_fw; } - client->irq = ret; return 0;