From patchwork Mon Apr 9 14:59:34 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: 10331639 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 88F2D6022E for ; Mon, 9 Apr 2018 14:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 799AC2898F for ; Mon, 9 Apr 2018 14:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CB80289A1; Mon, 9 Apr 2018 14:59:57 +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 D492E2898F for ; Mon, 9 Apr 2018 14:59:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886AbeDIO74 (ORCPT ); Mon, 9 Apr 2018 10:59:56 -0400 Received: from mail-by2nam01on0056.outbound.protection.outlook.com ([104.47.34.56]:12983 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751623AbeDIO7z (ORCPT ); Mon, 9 Apr 2018 10:59:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invensense.onmicrosoft.com; s=selector1-invensense-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YfyrJeUkptwPO6fl307RlfQbPFr8Ty+XcYN/PjN5Djg=; b=Nwdm8wZI1W3ODS0F/975HkHgFksMWbKKwg2WapAlHljXxqzJ1NHM12reP2B11TJ7rSCswEI9eEJ5wylV0P0D4wLj7eAjpPpob+AL7YDBQN/ZByZiFOklHKdef2VDTe54pBDhB+JG29guyC2I68xa51xsMI1Oa8b2+mohfrjCObQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=JManeyrol@invensense.com; Received: from [IPv6:2a01:e35:87fd:c140:b95b:f2c8:d4dc:e485] (2a01:e35:87fd:c140:b95b:f2c8:d4dc:e485) by MWHPR1201MB0192.namprd12.prod.outlook.com (2603:10b6:301:56::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Mon, 9 Apr 2018 14:59:51 +0000 To: linux-iio From: Jean-Baptiste Maneyrol Subject: [PATCH v2 4/4] iio: imu: inv_mpu6050: clean read channel data error path Message-ID: <557d892a-b796-32df-3db0-e64c6487c6e8@invensense.com> Date: Mon, 9 Apr 2018 16:59:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Language: fr-classic X-Originating-IP: [2a01:e35:87fd:c140:b95b:f2c8:d4dc:e485] X-ClientProxiedBy: VI1PR08CA0171.eurprd08.prod.outlook.com (2603:10a6:800:d1::25) To MWHPR1201MB0192.namprd12.prod.outlook.com (2603:10b6:301:56::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a07055e-56ad-4e8b-05f0-08d59e2a8c74 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:MWHPR1201MB0192; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 3:ATMzql4OCgrmp67KUez1NtKm6D6pGyl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5xsalVRr1CCjjKU3/CW6d95bijXeFYi/2XPyMbPvcxozcFdBYzHry7EaqrtqxiNO+QQr4lAB8Kj+UfTRFgu9MmGN+yOVHqN1OGLb6fvoMg0+VJToR9qHztnllmip3fzHnU8sSLrJEmhAhZBO3hAai2DI3cfxpItpDbgU7TuC2o7pRJ4AZwL1VdfkqVkagY1mWrgX4mrs5cSvTvG/yoMnCYywT/lIAw6Lr/cks7amSpSjsx+CcVndPibUkfRMXz6cBW01kl9q2FGEojFVUB3txwmVYWZV5Bvbnu5awZRvL0aG/KnfiZPkTkEMZrros68/W5k; 4:jm42Zo9+s4UfJHkvWJi4EXyK7ZJcvmSqepTtmsgEdjmW0l2i2rn8JLUsK66kNNRhJYo69c99Circes1QZtfGSceQLKBD+fZfjqZkofyG84Ar0Dws+/JVQZWik0El9PnR2mqBhTNGPIDs8vSq0CBIOgp2AF9sOLP15Wd9OJEP2krry8k+yv7GsGuBHJ1+/s7ZKqsdGaQ3Nl4bRH0R4tLn84E3TNJXif2QLa1uUUM3ZsP9m33nR2FV2sr9IjR5J/PTx9a+Ri8cR2/HGUIknsskC2RE6lOCYIoaOhpHIjL36P7QgYF1aZIstLTeZVi6xC2P X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(257004950022427); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:MWHPR1201MB0192; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB0192; X-Forefront-PRVS: 0637FCE711 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(376002)(366004)(346002)(39850400004)(199004)(189003)(58126008)(1706002)(2906002)(67846002)(305945005)(386003)(97736004)(80792005)(105586002)(106356001)(7736002)(2486003)(52146003)(23676004)(6486002)(52116002)(52396003)(6916009)(81166006)(6116002)(25786009)(47776003)(72206003)(81156014)(65956001)(65806001)(8676002)(5660300001)(64126003)(68736007)(6666003)(65826007)(50466002)(478600001)(31686004)(36756003)(8936002)(230700001)(16526019)(31696002)(86362001)(186003)(46003)(476003)(2616005)(316002)(486006)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0192; H:[IPv6:2a01:e35:87fd:c140:b95b:f2c8:d4dc:e485]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: invensense.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyMDFNQjAxOTI7MjM6bkczV05hRHlIT0hsZ0RxeERJRkg0T2tS?= =?utf-8?B?TFU4Z2RHMHV6VmMrSU5heTZVL1B1a2kyQmE2UkdoMDV0WTh4OUlGSXdrdmF6?= =?utf-8?B?NGdrQVFFU1g4ZFl3Y2pVWlpXcmxkYWZBS0QyUGpOUjhzTnhUUTNEVjAwVmZ4?= =?utf-8?B?UGtEc00wRnNvSUhnZ0UyekkzM2VXYTZqYURnN3VrYjc3Mnd5ODB6NlkyaXBK?= =?utf-8?B?SGp6eGtGN0hJRjl6TFZwek1SNFZpRDl2U0t3NDlGQmgzck1YdzdDbzNkOUFX?= =?utf-8?B?Rm9zYTk1VU15KzVaYlJTK0kxSWRkSGtvRHEyeG5ZYTRJZ1lRL2JHWXFJVWdY?= =?utf-8?B?cXNKaDg1M0ZEQWNFQ2c3Y2JpUGpGeXY3SThFUFVGdXFVQkRXWFVRL2IxbEwr?= =?utf-8?B?ZHdtbjJVY0pZVHNhRENpbE9UVDZFSTYwcXF0ZFROQ2FZZWg5YkJPSFAxMEZw?= =?utf-8?B?Rk5USElwQ2d1alRpb3hYMk9uNWRxL3owN3E1TStvdUNNbVRYYUV0WmxjZ3Ex?= =?utf-8?B?dGtIb3IxbVd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gTHcCGXN96CHQ07R6NcpaOMvfKiWY58qKxdljG6EYPjo1cdnTL6z+WTsP/dNU3vERzBuuNZW4tD93JBNBetPjdvWu5tLoRJSMHFDUvwoQiKu/vfWuhtqeJ8m9jceK1oWal0yzQ2O11dHKcxGcee2amu7Qzzx3iw=; 24:Lj/BhRXYoiHDUBI5Fb1dKNYILjTqdR+NRkdQGN5070u6rPlY670Fe2i0kg3XnjK/5TDITrwrRgOFKAq1/zO7YJ97hvgF7U3BrHZs2uS66E4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 7:xs1PKIQSOC24AaIhpk2WT/qb0M15skcaqG+iAVQmQXTUCjHDa/9sDmQn3rxNtcT6y7oCTdb14pAXglNgu7QVE8WagJHPFN9J7XyRyi7uH4Nh/xnbj8acpNjpwESsQLlpjJ4/pSi+fwSyO9QiKD1LmVYe+YKyyDFlT561YEprd4ZS8ZvAP0G1yK4dPgvQDAt+TlJ5wyJ78hCwVwGGieUY2yZDt+tp9QV4ks2rmofbvZjnml7Jtk6BqSWdkgU75ZPA X-OriginatorOrg: invensense.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2018 14:59:51.8459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a07055e-56ad-4e8b-05f0-08d59e2a8c74 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 462b3b3b-e42b-47ea-801a-f1581aac892d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0192 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 Signed-off-by: Jean-Baptiste Maneyrol --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) if (result) @@ -369,14 +369,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 diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 50d352f..02437ed 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -324,7 +324,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);