From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422878AbcE3Vxl (ORCPT ); Mon, 30 May 2016 17:53:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52816 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162488AbcE3VAU (ORCPT ); Mon, 30 May 2016 17:00:20 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christophe Ricard , Samuel Ortiz Subject: [PATCH 4.5 27/87] nfc: st21nfca: Fix static checker warning Date: Mon, 30 May 2016 13:49:25 -0700 Message-Id: <20160530204934.419013928@linuxfoundation.org> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160530204933.149873142@linuxfoundation.org> References: <20160530204933.149873142@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe Ricard commit b58afe6d6d3a53af165d5946f12c4b08c95acd58 upstream. Fix static checker warning: drivers/nfc/st21nfca/i2c.c:530 st21nfca_hci_i2c_acpi_request_resources() error: 'gpiod_ena' dereferencing possible ERR_PTR() Fix so that if no enable gpio can be retrieved an -ENODEV is returned. Reported-by: Dan Carpenter Fixes: dfa8070d7f64 ("nfc: st21nfca: Add support for acpi probing for i2c device.") Signed-off-by: Christophe Ricard Signed-off-by: Samuel Ortiz Signed-off-by: Greg Kroah-Hartman --- drivers/nfc/st21nfca/i2c.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -524,8 +524,10 @@ static int st21nfca_hci_i2c_acpi_request /* Get EN GPIO from ACPI */ gpiod_ena = devm_gpiod_get_index(dev, ST21NFCA_GPIO_NAME_EN, 1, GPIOD_OUT_LOW); - if (!IS_ERR(gpiod_ena)) - phy->gpio_ena = desc_to_gpio(gpiod_ena); + if (!IS_ERR(gpiod_ena)) { + nfc_err(dev, "Unable to get ENABLE GPIO\n"); + return -ENODEV; + } phy->gpio_ena = desc_to_gpio(gpiod_ena);