From patchwork Fri Oct 2 13:40:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 7316291 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B9B25BEEA4 for ; Fri, 2 Oct 2015 13:46:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA77D208C5 for ; Fri, 2 Oct 2015 13:46:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0457220553 for ; Fri, 2 Oct 2015 13:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788AbbJBNqG (ORCPT ); Fri, 2 Oct 2015 09:46:06 -0400 Received: from lists.s-osg.org ([54.187.51.154]:46945 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753018AbbJBNkt (ORCPT ); Fri, 2 Oct 2015 09:40:49 -0400 Received: from localhost.localdomain (148.103.23.95.dynamic.jazztel.es [95.23.103.148]) by lists.s-osg.org (Postfix) with ESMTPSA id 2C86446323; Fri, 2 Oct 2015 06:40:46 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , linux-input@vger.kernel.org, Dmitry Torokhov , Jingoo Han Subject: [PATCH 02/18] Input: ads7846 - use PTR_ERR_OR_ZERO() Date: Fri, 2 Oct 2015 15:40:13 +0200 Message-Id: <1443793229-22363-3-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443793229-22363-1-git-send-email-javier@osg.samsung.com> References: <1443793229-22363-1-git-send-email-javier@osg.samsung.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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 The PTR_ERR_OR_ZERO() helper function checks if a pointer contains an errno code and returns it or return 0 if that's not the case. Use the helper instead of open coding the same logic in the driver. This was found with make coccicheck that complains with the following warning: drivers/input/touchscreen/ads7846.c:532:1-3: WARNING: PTR_ERR_OR_ZERO can be used Signed-off-by: Javier Martinez Canillas --- drivers/input/touchscreen/ads7846.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 0f5f968592bd..727d88c900c1 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -529,10 +529,8 @@ static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts) ts->hwmon = hwmon_device_register_with_groups(&spi->dev, spi->modalias, ts, ads7846_attr_groups); - if (IS_ERR(ts->hwmon)) - return PTR_ERR(ts->hwmon); - return 0; + return PTR_ERR_OR_ZERO(ts->hwmon); } static void ads784x_hwmon_unregister(struct spi_device *spi,