Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2477072rdh; Sun, 29 Oct 2023 19:08:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoZoUhF7E0qdsCXukv2DuBAntPUZk1l20VhzUuxazb+4dXIEr2B+NOADfKhWWfiAY1cX+r X-Received: by 2002:a05:6a20:1383:b0:17a:fa76:805f with SMTP id hn3-20020a056a20138300b0017afa76805fmr7324778pzc.23.1698631693054; Sun, 29 Oct 2023 19:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698631693; cv=none; d=google.com; s=arc-20160816; b=JvT+A8WWlLKGMxF8EFubqNkKsZaJG/FGXYFAM0IaLlDJvRhR1acYwvcikOzckEoipr hgnthkUrqymM0VUUn+MjWoteKtSRdrL/UdHWwoMujw34fjYFY3qVd0JD8KB/FJQcG/zB /TodrCg8DAPRIaqrl/J8lpFuCms51AUExuI7hen4cz69xUyCm1+7kWTnhmc8E4VQgFga eIji2UU/MrTuzgi46DT6T6WzUbeg0irr+Q/Z2PCmFgcUTux4jgmjGs8sqJtVfhF9IkqB +DN3vTlFLDlMFBHUOyGqyykPon1C60PCRN6Lola0rHCAyw04SCElucTkYnC4xa/LR4pL IT3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bINMwevq8OGFJvLolaCLPuHnk2hF+y1LlhjWrt/LPCw=; fh=tdN0gxRbNmj8gni2xpkpQRlD8wL7eIfsGcQFLKXU0k4=; b=cosknO+86cn7n5QTxBRwymXVxDunwUU8recjM4mVTpMocf/zEKgaNRGns0suHR7P2v relFB0ixE24R2+ijVnvnlQO2mhBr3oftRgyh3LRyZ5FAJqKiFutLLJxFdAw/95a8N6a7 3YWodalFtKWJ5utv9Z0NtXCzIH84qAVSMD5ls64fiTk5kEy+qlWyPDB6kQWIGx6sRQPb PEBjshCzTZzwW20XN4RVXKoVogYMZsB3vKlohCoVdIRM2SM4cAqXtDxBLMwthV0IBsVf yABcceBrjxJcXkwAmYSS0jq23d5EjiQiJBtkrNNUH5HGUSk1328m3KXesfoTUo82MBfj ns0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h15-20020a170902f54f00b001ca4e2a35efsi4354706plf.45.2023.10.29.19.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 19:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id ABA0F8040E83; Sun, 29 Oct 2023 19:08:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbjJ3CIJ (ORCPT + 99 others); Sun, 29 Oct 2023 22:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjJ3CII (ORCPT ); Sun, 29 Oct 2023 22:08:08 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id E712693; Sun, 29 Oct 2023 19:08:05 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id BC42D6027E05D; Mon, 30 Oct 2023 10:08:02 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: jic23@kernel.org, lars@metafoo.de Cc: Su Hui , jean-baptiste.maneyrol@tdk.com, chenhuiz@axis.com, andy.shevchenko@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] iio: imu: inv_mpu6050: return callee's error code rather than -EINVAL Date: Mon, 30 Oct 2023 10:07:53 +0800 Message-Id: <20231030020752.67630-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 19:08:11 -0700 (PDT) regmap_bulk_write()/regmap_bulk_read() return zero or negative error code, return the callee's error code is better than '-EINVAL'. Signed-off-by: Su Hui --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index a9a5fb266ef1..5ded0781797c 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -572,7 +572,7 @@ static int inv_mpu6050_sensor_set(struct inv_mpu6050_state *st, int reg, ind = (axis - IIO_MOD_X) * 2; result = regmap_bulk_write(st->map, reg + ind, &d, sizeof(d)); if (result) - return -EINVAL; + return result; return 0; } @@ -586,7 +586,7 @@ static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg, ind = (axis - IIO_MOD_X) * 2; result = regmap_bulk_read(st->map, reg + ind, &d, sizeof(d)); if (result) - return -EINVAL; + return result; *val = (short)be16_to_cpup(&d); return IIO_VAL_INT; -- 2.30.2