Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2475585rdh; Sun, 29 Oct 2023 19:03:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1pcIsOhZf48LgV3jDlEYSZrLa9pnM9vLX/r44nqWb/eSmSo4JJCIfncfQ8u1JEn6NS7BM X-Received: by 2002:a17:902:e545:b0:1cc:468d:526c with SMTP id n5-20020a170902e54500b001cc468d526cmr1101702plf.9.1698631439397; Sun, 29 Oct 2023 19:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698631439; cv=none; d=google.com; s=arc-20160816; b=DrbiHET2XZv2ImFHGDGb3pogkO9Oa01SPJVMlAoQzm1nQ0XHO/C+ZET9ZfFr+jmANB GQxzklnNxOIw9iQrDVW4or/WrPfMWZdIWGDDeXuJquzgeVFaWKhAIwPHnmQ44Qg2a+hi y7MzytIWtHNsgjcTui7CDoVwJWyJj+7zPFCAyJnyZIcQQ9GDTGBcRJUX1oV3mp/UcaRl 1Nd7PcCApKpZUle0yNSqFepQM54t8dkXTVEP2RGMhnWCX6SC86kmvwEhTl8xzLnJpEOo NMRUI/OJYKwg0O7uYmJYZ1bO+g4cZy+Gg4PDG8luDgrsdNdxXe4VGVlTU69iPtz8jHNz +81A== 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=cd2oKsSsXpIo1f5cskOfO+e2EQkrey3ZkQPKgn6GO6Q=; fh=2cSeFgoQ0JBhgoMYrgxHWK6XJgTQwEXyiarcWtY1l2w=; b=gghRP1pCBiNf/JaRInvwqy+v4k8eonK/OuIUbyrKAdszE+OlnydM1jbkmGBimPPPzV flmxt/s3VZa++vn29kCCGa26gJwcRbLGdPFFtjEu9EDbwmtZG2Qoh5T2um2+rGwdpEZy K9/120JMBkRJS2uXvjFPjibSgWGakbh4ZDyK0GLoRsWonTo5qgcZH8tZ/DskZUmxg56Q RKAScG+0fwCIc+U//rcAfEXkNGUAC0ucqnAKEjjFypsOp3QBJXThsdIm+MfQhK+RBfoy MK48GKfq3ZIMOHQcYaKKj2Mur+GIW/adcZyoKq+4Tu8GFjr/FJ1oxHogGKhqhsKGuYrZ x4zQ== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ks11-20020a170903084b00b001bbc80a2a3asi4329588plb.299.2023.10.29.19.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 19:03:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 92245807C857; Sun, 29 Oct 2023 19:03:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbjJ3CDZ (ORCPT + 99 others); Sun, 29 Oct 2023 22:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjJ3CDY (ORCPT ); Sun, 29 Oct 2023 22:03:24 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id DD96BBE; Sun, 29 Oct 2023 19:03:20 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id E5EC16027E066; Mon, 30 Oct 2023 10:02:53 +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, andy.shevchenko@gmail.com, chenhuiz@axis.com, mranostay@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v3] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw Date: Mon, 30 Oct 2023 10:02:19 +0800 Message-Id: <20231030020218.65728-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 19:03:34 -0700 (PDT) inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the true value rather than only return IIO_VAL_INT. Fixes: d5098447147c ("iio: imu: mpu6050: add calibration offset support") Signed-off-by: Su Hui --- v3: - add Fixes tag v2: - fix the error of commit title. v1: - https://lore.kernel.org/all/20231020091413.205743-2-suhui@nfschina.com/ 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 29f906c884bd..a9a5fb266ef1 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -749,13 +749,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev, ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset, chan->channel2, val); mutex_unlock(&st->lock); - return IIO_VAL_INT; + return ret; case IIO_ACCEL: mutex_lock(&st->lock); ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset, chan->channel2, val); mutex_unlock(&st->lock); - return IIO_VAL_INT; + return ret; default: return -EINVAL; -- 2.30.2