From patchwork Mon Mar 7 18:39:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 8521601 Return-Path: X-Original-To: patchwork-linux-media@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 71B079F7CA for ; Mon, 7 Mar 2016 18:39:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1240202DD for ; Mon, 7 Mar 2016 18:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9CF2202C8 for ; Mon, 7 Mar 2016 18:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbcCGSji (ORCPT ); Mon, 7 Mar 2016 13:39:38 -0500 Received: from mleia.com ([178.79.152.223]:44729 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbcCGSji (ORCPT ); Mon, 7 Mar 2016 13:39:38 -0500 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 51C044119A5; Mon, 7 Mar 2016 18:43:04 +0000 (GMT) From: Vladimir Zapolskiy To: Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Subject: [PATCH] media: i2c/adp1653: fix check of devm_gpiod_get() error code Date: Mon, 7 Mar 2016 20:39:32 +0200 Message-Id: <1457375972-9923-1-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20160307_184304_355853_72634796 X-CRM114-Status: GOOD ( 11.27 ) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The devm_gpiod_get() function returns either a valid pointer to struct gpio_desc or ERR_PTR() error value, check for NULL is bogus. Signed-off-by: Vladimir Zapolskiy --- drivers/media/i2c/adp1653.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index fb7ed73..9e1731c 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -466,9 +466,9 @@ static int adp1653_of_init(struct i2c_client *client, of_node_put(child); pd->enable_gpio = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW); - if (!pd->enable_gpio) { + if (IS_ERR(pd->enable_gpio)) { dev_err(&client->dev, "Error getting GPIO\n"); - return -EINVAL; + return PTR_ERR(pd->enable_gpio); } return 0;