From patchwork Tue Apr 17 08:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Baptiste Maneyrol X-Patchwork-Id: 10344527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B34296039A for ; Tue, 17 Apr 2018 08:07:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7A31287D4 for ; Tue, 17 Apr 2018 08:07:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B3842899D; Tue, 17 Apr 2018 08:07:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39C8F287D4 for ; Tue, 17 Apr 2018 08:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751183AbeDQIH6 (ORCPT ); Tue, 17 Apr 2018 04:07:58 -0400 Received: from mail-co1nam03on0061.outbound.protection.outlook.com ([104.47.40.61]:14023 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751358AbeDQIH5 (ORCPT ); Tue, 17 Apr 2018 04:07:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invensense.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Qtx10GMc9UlZVSCFCutYdbQe1acirF6Qtn/wsHRjois=; b=OGvYeBju+RIEBx9zM3zimpMtZ1Ta59ltuvIw3a7nphElPC1E9JIPlKYu2EH3Q2k1OgzzfJMKbwcrdCLlOW6gDUwPvPLOiooFnQ7TCVsTLl4yVzcwJnfRD/OHAoKq5xhzylaCPXJouBWeZPtF8LLimN0N1WtcQwvkQE404HN16d4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=JManeyrol@invensense.com; Received: from frgnb-l-34296kv.invcorp.invensense.com (92.154.85.143) by CY4PR1201MB0181.namprd12.prod.outlook.com (2603:10b6:910:1d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.10; Tue, 17 Apr 2018 08:07:55 +0000 From: Jean-Baptiste Maneyrol To: linux-iio@vger.kernel.org Cc: Jean-Baptiste Maneyrol Subject: [PATCH v3 4/4] iio: imu: inv_mpu6050: clean read channel data error path Date: Tue, 17 Apr 2018 10:07:22 +0200 Message-Id: <1523952442-20104-4-git-send-email-jmaneyrol@invensense.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523952442-20104-1-git-send-email-jmaneyrol@invensense.com> References: <1523952442-20104-1-git-send-email-jmaneyrol@invensense.com> MIME-Version: 1.0 X-Originating-IP: [92.154.85.143] X-ClientProxiedBy: HE1PR05CA0162.eurprd05.prod.outlook.com (2603:10a6:7:28::49) To CY4PR1201MB0181.namprd12.prod.outlook.com (2603:10b6:910:1d::10) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR1201MB0181; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0181; 3:RTDGYDEXjJlSFVFmK6wrSJMINxyazfL7LIMjWWfMWgWAVwNFEJ06Vco5tVngC2re6ljqFpE08FtzZk7djmnr6V1BookeNaWJiwG/CpMj5B9KsU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eTg0KOVsLaiRP6ma1ncNl7NzyUYbz9WT50jpCH78Ca/Wy/oXjDc6Wto871+dDc4FNg9th2fwwbCLiggYvKbercqBuP4XVs3TlyFInAkYx2qPTXWTIHAZ/bonWlrWm0u3qL335eQmjysjLsh+AKvbKVFyNT6WTP4360CL5/0Ob5f5MVIGmyviQop2NO4oOpvNp0UdzLOmQnATfO1EzCuCHwNYXJz2+vhYgmh6l; 4:EXtXYBGc6s/Ex7RH4X3wx3M1qsktqkodRCILm5h/PYAzV/OCxnpto8hs/68ZO7328lJfstp8LOtYtMru5NkxK4aVSokMjHugHHKlOt86O3RDBRFvfqXsZ9MdpZ6UjqyPtlTqG5Q4Hxfb15ryjdtqmB42jH9iODxdZPWQoTzu3c2M3f0lc+fcv3QFEsc+HQh9IxMhXYXyu62Aac8lcFFEM+7MGMtt+pMe0EwH1g74jz9ppxaLH95+O8ky+yBmaZ32pq0bJNLj3NtQAMjSszR9jw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501327)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:CY4PR1201MB0181; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB0181; X-Forefront-PRVS: 0645BEB7AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(376002)(396003)(39850400004)(346002)(189003)(199004)(105586002)(50466002)(4326008)(476003)(5660300001)(26005)(16526019)(956004)(305945005)(486006)(53936002)(3846002)(7736002)(107886003)(6486002)(6116002)(2616005)(11346002)(446003)(316002)(106356001)(16586007)(86362001)(575784001)(6916009)(72206003)(66066001)(97736004)(6666003)(2361001)(47776003)(81156014)(50226002)(186003)(81166006)(2351001)(2906002)(80792005)(8936002)(8676002)(25786009)(478600001)(68736007)(76176011)(51416003)(48376002)(36756003)(7696005)(386003)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0181; H:frgnb-l-34296kv.invcorp.invensense.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: invensense.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0181; 23:jeqzWWmT9wJD/9KkxdnCwh6mOoEwTfBCci+ftm1?= =?us-ascii?Q?fnuzH91MUOm3UA6gkZ1AgciZFcOmk4rtMhLJjFlItexoctuN+xvxOrAHjQ9a?= =?us-ascii?Q?dx/rXxjBCud/mQ2tJ+DdvM57anpO7FoNB2JAAS1howqiXdIp6eAwi7E3Lkdu?= =?us-ascii?Q?Xf8D6P598D+FkwIev971vlRFuJ7smYx7WuPS4lHnHNim7TovWK1XVtRQLnj6?= =?us-ascii?Q?YMDZ6m17SSDmgQ7lcbICqQXiLzc6khcGPh09w0J/irHaipsyFHrWo7jYTDmg?= =?us-ascii?Q?87bscV4QEuYHYNtmhYRs+GXgXXIoI+J3ChloEqMpkJXvYBOTkEgxhS8dQt5h?= =?us-ascii?Q?XBt7/x0YQPp3uhiN+Nh4Ch5Ooeda96sRLWNQx3V0qpbwFXWEIpSGuHiIKc2e?= =?us-ascii?Q?j4i7jbQ2KV6YOBQnLMqV9afybu9CTCV0R393Q+zmHP2llE0nwrrVlgrtokM9?= =?us-ascii?Q?Jjvv3h4AdgRSzWnjiMuJ6BWlVADYYw0aFrApF1AJtc9mDe9PsAk+8YDbm3TB?= =?us-ascii?Q?n6Au2k0HOfZ/me0JyIKACWzgQk779P877a/weJB6COG/eUCN7TKwaa1cYJJW?= =?us-ascii?Q?RfcxvDmH3CwqVldR/235Qetn24rnIv9c9m4svbm/3ewuO+4s0STecMPLwxsa?= =?us-ascii?Q?Y0fwNfZNqk2d9jPeBfyaIXkz8GQ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X-MS-Office365-Filtering-Correlation-Id: d693a606-6198-40a0-e5ea-08d5a43a5391 X-OriginatorOrg: invensense.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2018 08:07:55.1484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d693a606-6198-40a0-e5ea-08d5a43a5391 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 462b3b3b-e42b-47ea-801a-f1581aac892d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0181 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index a0cecd9..b842caf 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -330,7 +330,7 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev, { struct inv_mpu6050_state *st = iio_priv(indio_dev); int result; - int ret = IIO_VAL_INT; + int ret; result = iio_device_claim_direct_mode(indio_dev); if (result) @@ -375,14 +375,18 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev, break; } -error_power_off: - result |= inv_mpu6050_set_power_itg(st, false); -error_release: - iio_device_release_direct_mode(indio_dev); + result = inv_mpu6050_set_power_itg(st, false); if (result) - return result; + goto error_power_off; + iio_device_release_direct_mode(indio_dev); return ret; + +error_power_off: + inv_mpu6050_set_power_itg(st, false); +error_release: + iio_device_release_direct_mode(indio_dev); + return result; } static int