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: 31277 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9686720AE6 for ; Mon, 2 Jun 2014 10:26:39 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id m1sf26238373oag.2 for ; Mon, 02 Jun 2014 03:26:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=yxu+8X6xyw2FA4stnal+u7auT1e/CDeU45Zm1HJX8Iw=; b=kz3NiBQOf2A76BwepcNjyTeh6LKM03dP8AGID8vH2oI4estVDL6wT3uh1jiuLFKorH rzdBJ52AYMazuiSUzX9bEmiQKvF2HRCZUwkZgy12XLY1zHf9WvfwQoqMDvXz8ykUbRjw 52Q5dMyIpzl9JtYAF6uti95tabBuWjEZZwhAGTwjDmqgAX+So859MEz0vvH26PLR3mem b8d0dD03FQLKbDS6n2DP9zELIXRPyfDFBMMEFHgNNT98QAJidhMRP6JuPIPY8bzcPGOH QGovWv9WGwSQcFf5zLi88lwgFkRhRlKPdsOWVAPvTWTszQG2AWKmCC5RXX/iVwkWTE2N OVlw== X-Gm-Message-State: ALoCoQmgEEE6I8RdOPmpP3namSrBSeCgBqfx/mGfzG97iN10yPJ/C+H8m6GdlDffbMhrNdlNMj2Y X-Received: by 10.182.103.199 with SMTP id fy7mr14615503obb.18.1401704799186; Mon, 02 Jun 2014 03:26:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.81 with SMTP id b75ls1944055qgd.34.gmail; Mon, 02 Jun 2014 03:26:39 -0700 (PDT) X-Received: by 10.52.162.168 with SMTP id yb8mr3888323vdb.22.1401704799049; Mon, 02 Jun 2014 03:26:39 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id so6si7624184vdb.76.2014.06.02.03.26.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 03:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jw12so4935952veb.34 for ; Mon, 02 Jun 2014 03:26:39 -0700 (PDT) X-Received: by 10.53.12.229 with SMTP id et5mr3999686vdd.32.1401704798962; Mon, 02 Jun 2014 03:26:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp86772vcb; Mon, 2 Jun 2014 03:26:38 -0700 (PDT) X-Received: by 10.69.31.65 with SMTP id kk1mr37050706pbd.126.1401704798174; Mon, 02 Jun 2014 03:26:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ia5si15180616pbb.236.2014.06.02.03.26.37; Mon, 02 Jun 2014 03:26:37 -0700 (PDT) Received-SPF: none (google.com: linux-input-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; 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-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: list List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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: