Return-path: 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) 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> (sfid-20141114_232944_010549_F25C9973) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-wireless-owner@vger.kernel.org List-ID: 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; -- 2.1.0.rc2.206.gedb03e5 -- Dmitry