From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C825FC00A98 for ; Fri, 20 Oct 2023 15:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377796AbjJTPzQ (ORCPT ); Fri, 20 Oct 2023 11:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377676AbjJTPzO (ORCPT ); Fri, 20 Oct 2023 11:55:14 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EF42BF; Fri, 20 Oct 2023 08:55:13 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SBpy04L8bz6K62H; Fri, 20 Oct 2023 23:52:40 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 20 Oct 2023 16:55:10 +0100 Date: Fri, 20 Oct 2023 16:55:09 +0100 From: Jonathan Cameron To: Su Hui CC: , , , , , , , Subject: Re: [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw Message-ID: <20231020165509.00003350@Huawei.com> In-Reply-To: <20231020091413.205743-2-suhui@nfschina.com> References: <20231020091413.205743-1-suhui@nfschina.com> <20231020091413.205743-2-suhui@nfschina.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Oct 2023 17:14:14 +0800 Su Hui wrote: > inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the > true value rather than only return IIO_VAL_INT. What does this have to do with the phy: mapphone-mdm6600? > > Signed-off-by: Su Hui I'm not sure why inv_mpu6050_sensor_show() doesn't return the actual error code from the regmap_bulk_read() and instead replaces it with -EINVAL. Given you are tidying up this related issues perhaps change that as well? static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg, int axis, int *val) { int ind, result; __be16 d; ind = (axis - IIO_MOD_X) * 2; result = regmap_bulk_read(st->map, reg + ind, &d, sizeof(d)); if (result) return -EINVAL; //Make this return result; *val = (short)be16_to_cpup(&d); return IIO_VAL_INT; } > --- > 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;