From patchwork Thu Feb 7 23:58:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 2113751 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 56EA740106 for ; Thu, 7 Feb 2013 23:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751501Ab3BGX7S (ORCPT ); Thu, 7 Feb 2013 18:59:18 -0500 Received: from smtp206.alice.it ([82.57.200.102]:57996 "EHLO smtp206.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512Ab3BGX7S (ORCPT ); Thu, 7 Feb 2013 18:59:18 -0500 Received: from jcn (87.13.159.233) by smtp206.alice.it (8.6.058.01) id 508F91B90FEF1584; Fri, 8 Feb 2013 00:59:16 +0100 Received: from ao2 by jcn with local (Exim 4.80) (envelope-from ) id 1U3bMd-0003YG-SH; Fri, 08 Feb 2013 00:58:47 +0100 From: Antonio Ospite To: linux-input@vger.kernel.org Cc: Albert Zhang , Eric Andersson , Jonathan Cameron , Michael Trimarchi , Antonio Ospite Subject: [PATCH 1/2] Input: misc/bma150.c, fix checking pm_runtime_get_sync() return value Date: Fri, 8 Feb 2013 00:58:24 +0100 Message-Id: <1360281506-13618-2-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360281506-13618-1-git-send-email-ospite@studenti.unina.it> References: <1360281506-13618-1-git-send-email-ospite@studenti.unina.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Michael Trimarchi When PM_RUNTIME is not defined, pm_runtime_get_sync() returns 1, see include/linux/pm_runtime.c::__pm_runtime_resume(), and the check of the return value was overlooking this, in this case bma150_open() would return 1 which is not expected by upper layers. Maybe the check for != -ENOSYS (Function not implemented) was meant to cover this, but pm_runtime_get_sync() does not return this value. For now fix the issue locally by checking explicitly for negative return values. Signed-off-by: Michael Trimarchi Signed-off-by: Antonio Ospite --- drivers/input/misc/bma150.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 08ffcab..e5d1894 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -372,7 +372,7 @@ static int bma150_open(struct bma150_data *bma150) int error; error = pm_runtime_get_sync(&bma150->client->dev); - if (error && error != -ENOSYS) + if (error < 0 && error != -ENOSYS) return error; /*