From patchwork Mon Jun 2 10:24:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 4281101 Return-Path: X-Original-To: patchwork-linux-input@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 795B69F1D6 for ; Mon, 2 Jun 2014 10:26:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B3C220263 for ; Mon, 2 Jun 2014 10:26:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F10C02021B for ; Mon, 2 Jun 2014 10:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007AbaFBK0h (ORCPT ); Mon, 2 Jun 2014 06:26:37 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:63335 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbaFBK0g (ORCPT ); Mon, 2 Jun 2014 06:26:36 -0400 Received: by mail-pb0-f43.google.com with SMTP id up15so4075599pbc.16 for ; Mon, 02 Jun 2014 03:26:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=kHDSBhukTxDgQ8mevX97DCpyKIFnCeP7eW5uf4FPRzc=; b=KIv6jw4nzYr08URt4ZahSr8RaJKElJdsxUBbB7cWpkIt8NaSlqbRsKFFWrRlUHDguF 0OsUnVW7k1I5d67lV8QGwY32uRl6eodYEvLYzJZblQxW678asn1ohKGtC/xViyG069KF A3SLEu3jhPtMJireyWFbTtLWwtyzOTnm1NlbsLpnWKLN93el6/l5T6qrZ+VHV9FX3GSn 08BaxtUcmpf1VCHBrwiJ/UhvOD3MwocZbyXFhyf+MH0GnGEe9oOuGqdxooh0LbTufIlV XQ1Od6VnLQW7FN0xgulPQ01b5auwvdyV2YF7iuSck5VRi1ICGnapthlOQ/MeYTeJTrv0 Er3Q== X-Gm-Message-State: ALoCoQnCIywG6i7FHcoAn+LPMpcmWvxfuEgqK/bbL8eP81KRawQ00HeXAp7CKkyFmKXdhhBwRB9s X-Received: by 10.66.190.167 with SMTP id gr7mr38348539pac.75.1401704796164; Mon, 02 Jun 2014 03:26:36 -0700 (PDT) Received: from linaro.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id xk1sm62065561pac.21.2014.06.02.03.26.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 03:26:35 -0700 (PDT) From: Sachin Kamat To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, sachin.kamat@linaro.org, Donggeun Kim Subject: [PATCH v2 1/1] Input: max8997_haptic - Check return values Date: Mon, 2 Jun 2014 15:54:03 +0530 Message-Id: <1401704643-27846-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Check the return value of regulator_enable and pwm_enable to avoid errors. Fixes the following warning: drivers/input/misc/max8997_haptic.c:185:19: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sachin Kamat Cc: Donggeun Kim --- Changes since v1: * checked the return value of pwm_enable as suggested by Dmitry. * Make chip->enabled = true only if enablement is successful. --- drivers/input/misc/max8997_haptic.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c index 1fea5484941f..11f4d84625b3 100644 --- a/drivers/input/misc/max8997_haptic.c +++ b/drivers/input/misc/max8997_haptic.c @@ -181,11 +181,20 @@ static void max8997_haptic_enable(struct max8997_haptic *chip) } if (!chip->enabled) { - chip->enabled = true; - regulator_enable(chip->regulator); + error = regulator_enable(chip->regulator); + if (error) { + dev_err(chip->dev, "Failed to enable regulator\n"); + goto out; + } max8997_haptic_configure(chip); - if (chip->mode == MAX8997_EXTERNAL_MODE) - pwm_enable(chip->pwm); + if (chip->mode == MAX8997_EXTERNAL_MODE) { + error = pwm_enable(chip->pwm); + if (error) { + dev_err(chip->dev, "Failed to enable PWM\n"); + goto out; + } + } + chip->enabled = true; } out: