Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2520571rdh; Sun, 26 Nov 2023 09:07:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQ8B5qX+66HdN5xrwfuBvEJx3UYZJCuRWXr5UxZvUnP+/lQgQGcMl58torUe6Yh/+GpT2g X-Received: by 2002:a17:90b:4c52:b0:285:9ab2:54a1 with SMTP id np18-20020a17090b4c5200b002859ab254a1mr5527500pjb.41.1701018447806; Sun, 26 Nov 2023 09:07:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701018447; cv=none; d=google.com; s=arc-20160816; b=hE64jkVelbgBSvLdSDZwWoslNWz3B0f1Pe0OGvykdy+fn75YhAM4htf2LUGfs1nFsi PcE2n5xHzxDhWLzkVrL5e8G527CTzPIXMKvz5adL60dlj1mhNW9HFbXsj0QREdmTJXtn vgS8sShmN1rg5bfmJzgzuZVyjLiRPgWNUYPFn3I5sm7QRVH4CG1EjuC8JfvlxgmiquDN ++Z0gaCLv98cZlTQ7PKLs+WgZgj5n/vdCsPMEf3jRIzvrfcV5pgxyPL352PugWm+srcN 9AQQSzyLKBnzMstKLN/vskEJRMNW7ynfQbTs3MVuI6UpPzFJe450rgIVkSr/ORccHCK9 ZFGQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7ueLhL9yxBekm7a5MX+zKkgK9FeLZ5wfIwO+Nac46YY=; fh=smIRNwGU58edF/39mA+lNwnjZ5m/8Aa4YXB4KSInAus=; b=R5kDC3KyIjQB3+laY7Evy/9W7dATr7WTv4F5Q9C88PbAm4yVYGp/ZWiqanu4RxV0hd d5ymBMZeUJi4ru839Q0PWA0CkIdkdsJYMCDlAkeWA0VcHEyUEtDba2sg04zKEbhybula fvLF5vrLHds+a69OGxmFZiovFIRr6izP9uWBR1FwfDm30F9DEd/u6vOTRr/eBf6H+oZg 1SHA5WPOrbPEKLGEf5Rpf1T9JArkiNS0JJEhdgdslH5B8TEexZVDgPEqUYKm8E7kb0yB av6BCM5c2KR0K9/0tv2pvbm25/fwMhWa0c0O5soaxS9g3Ey5b1eJj3zjcW8ZUOg5+/t/ eCEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LRTmJQ3x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id om8-20020a17090b3a8800b00285d58914ddsi142429pjb.51.2023.11.26.09.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 09:07:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LRTmJQ3x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D49A8804C552; Sun, 26 Nov 2023 09:07:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbjKZRHC (ORCPT + 99 others); Sun, 26 Nov 2023 12:07:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjKZRHB (ORCPT ); Sun, 26 Nov 2023 12:07:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DABEFA for ; Sun, 26 Nov 2023 09:07:08 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85A08C433C7; Sun, 26 Nov 2023 17:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701018428; bh=XUM7qw4H5Ny7dZR+MIodYJqjaaevZ0Fq9kn1EHutWXc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LRTmJQ3xoY1hLDtcHRx+zh0vqin88ikJAaqkKXbeQBPgdpdMb7EN9II+FYQWLCxKN x1fY/MjjzXIbFiFikjMXSjppbLfeEzTWcyLudo4O+CnVfWRx5I6KvFArjkT7qSmMpD CyapR6bScFuplZRJOSSwOFqsxWTwW11PWMlNtPZllln7CSZMpa8vk7ghopfSLZSvdY 8Xp2M7TjfAI8sPpupBhPDJpOZyaSqg8v+tDmbtDRQZCkUIKAHS0Zdedjslwb7/17u0 9gD++jL+iZtGHHwF6z+8xvzJsZPdcmS6EA0AHIFwxOA3LMZQrizz1hnWdOlESxu74E ma4FxdS0A3xjA== Date: Sun, 26 Nov 2023 17:07:00 +0000 From: Jonathan Cameron To: Su Hui Cc: lars@metafoo.de, 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: Re: [PATCH] iio: imu: inv_mpu6050: return callee's error code rather than -EINVAL Message-ID: <20231126170700.550d20e7@jic23-huawei> In-Reply-To: <20231030020752.67630-1-suhui@nfschina.com> References: <20231030020752.67630-1-suhui@nfschina.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Sun, 26 Nov 2023 09:07:25 -0800 (PST) On Mon, 30 Oct 2023 10:07:53 +0800 Su Hui wrote: > regmap_bulk_write()/regmap_bulk_read() return zero or negative error > code, return the callee's error code is better than '-EINVAL'. Thanks and fully agree - though one small tweak I made whilst applying is mentioned below. Applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if we missed anything. > > 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; I tweaked this to go further return regmap_bulk_write(); > } > @@ -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;