public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on
@ 2023-10-20  9:14 Su Hui
  2023-10-20  9:14 ` [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw Su Hui
  2023-11-16 11:26 ` [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Vinod Koul
  0 siblings, 2 replies; 7+ messages in thread
From: Su Hui @ 2023-10-20  9:14 UTC (permalink / raw)
  To: vkoul, kishon
  Cc: Su Hui, u.kleine-koenig, linux-phy, linux-kernel, kernel-janitors

When wait_for_completion_timeout() failed, error is assigned
'-ETIMEDOUT'. But this error code is never used. Return '-ETIMEDOUT'
directly to fix this problem.

Signed-off-by: Su Hui <suhui@nfschina.com>
---

I'm not sure that return directly is true or not, maybe need some 
process before return directly.

 drivers/phy/motorola/phy-mapphone-mdm6600.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
index 1d567604b650..e84e3390bff0 100644
--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
+++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
@@ -421,8 +421,8 @@ static int phy_mdm6600_device_power_on(struct phy_mdm6600 *ddata)
 			dev_info(ddata->dev, "Powered up OK\n");
 	} else {
 		ddata->enabled = false;
-		error = -ETIMEDOUT;
 		dev_err(ddata->dev, "Timed out powering up\n");
+		return -ETIMEDOUT;
 	}
 
 	/* Reconfigure mode1 GPIO as input for OOB wake */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw
  2023-10-20  9:14 [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Su Hui
@ 2023-10-20  9:14 ` Su Hui
  2023-10-20 15:55   ` Jonathan Cameron
  2023-11-16 11:26 ` [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Vinod Koul
  1 sibling, 1 reply; 7+ messages in thread
From: Su Hui @ 2023-10-20  9:14 UTC (permalink / raw)
  To: jic23, lars
  Cc: Su Hui, jean-baptiste.maneyrol, chenhuiz, andy.shevchenko,
	linux-iio, linux-kernel, kernel-janitors

inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
true value rather than only return IIO_VAL_INT.

Signed-off-by: Su Hui <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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw
  2023-10-20  9:14 ` [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw Su Hui
@ 2023-10-20 15:55   ` Jonathan Cameron
  2023-10-23  1:33     ` Su Hui
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2023-10-20 15:55 UTC (permalink / raw)
  To: Su Hui
  Cc: jic23, lars, jean-baptiste.maneyrol, chenhuiz, andy.shevchenko,
	linux-iio, linux-kernel, kernel-janitors

On Fri, 20 Oct 2023 17:14:14 +0800
Su Hui <suhui@nfschina.com> 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 <suhui@nfschina.com>

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;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw
  2023-10-20 15:55   ` Jonathan Cameron
@ 2023-10-23  1:33     ` Su Hui
  2023-10-23  3:29       ` Su Hui
  0 siblings, 1 reply; 7+ messages in thread
From: Su Hui @ 2023-10-23  1:33 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: jic23, lars, jean-baptiste.maneyrol, chenhuiz, andy.shevchenko,
	linux-iio, linux-kernel, kernel-janitors

On 2023/10/20 23:55, Jonathan Cameron wrote:
> What does this have to do with the phy: mapphone-mdm6600?
Oh, really sorry for this. My careless mistake :( .
> 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;

Sure, I will tidy up this, Thanks for your suggestion!

Su Hui


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw
  2023-10-23  1:33     ` Su Hui
@ 2023-10-23  3:29       ` Su Hui
  0 siblings, 0 replies; 7+ messages in thread
From: Su Hui @ 2023-10-23  3:29 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: jic23, lars, jean-baptiste.maneyrol, chenhuiz, andy.shevchenko,
	linux-iio, linux-kernel, kernel-janitors

On 2023/10/23 09:33, Su Hui wrote:
> On 2023/10/20 23:55, Jonathan Cameron wrote:
>> 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;
>
> Sure, I will tidy up this, Thanks for your suggestion!

I'm not sure  whether the caller could handler this  when return 
'result' rather than '-EINVAL'.

This is not a big problem, maybe we shouldn't modify this code.

Su Hui


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on
  2023-10-20  9:14 [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Su Hui
  2023-10-20  9:14 ` [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw Su Hui
@ 2023-11-16 11:26 ` Vinod Koul
  2023-11-17  1:22   ` Su Hui
  1 sibling, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2023-11-16 11:26 UTC (permalink / raw)
  To: Su Hui; +Cc: kishon, u.kleine-koenig, linux-phy, linux-kernel, kernel-janitors

On 20-10-23, 17:14, Su Hui wrote:
> When wait_for_completion_timeout() failed, error is assigned
> '-ETIMEDOUT'. But this error code is never used. Return '-ETIMEDOUT'
> directly to fix this problem.

Where is patch 2/2?
> 
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
> 
> I'm not sure that return directly is true or not, maybe need some 
> process before return directly.
> 
>  drivers/phy/motorola/phy-mapphone-mdm6600.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
> index 1d567604b650..e84e3390bff0 100644
> --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
> +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
> @@ -421,8 +421,8 @@ static int phy_mdm6600_device_power_on(struct phy_mdm6600 *ddata)
>  			dev_info(ddata->dev, "Powered up OK\n");
>  	} else {
>  		ddata->enabled = false;
> -		error = -ETIMEDOUT;
>  		dev_err(ddata->dev, "Timed out powering up\n");
> +		return -ETIMEDOUT;

>  	}
>  
>  	/* Reconfigure mode1 GPIO as input for OOB wake */
> -- 
> 2.30.2

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on
  2023-11-16 11:26 ` [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Vinod Koul
@ 2023-11-17  1:22   ` Su Hui
  0 siblings, 0 replies; 7+ messages in thread
From: Su Hui @ 2023-11-17  1:22 UTC (permalink / raw)
  To: Vinod Koul
  Cc: kishon, u.kleine-koenig, linux-phy, linux-kernel, kernel-janitors

On 2023/11/16 19:26, Vinod Koul wrote:
> On 20-10-23, 17:14, Su Hui wrote:
>> When wait_for_completion_timeout() failed, error is assigned
>> '-ETIMEDOUT'. But this error code is never used. Return '-ETIMEDOUT'
>> directly to fix this problem.
> Where is patch 2/2?

Hi,

Sorry, I send a error patch 2/2 because of my carelessness.

This is the address of patch 2/2 which is irrelevant about this patch.

https://lore.kernel.org/all/7f81d365-0440-de01-8be4-9c8d3ab9d69c@nfschina.com/

Su Hui

>> Signed-off-by: Su Hui <suhui@nfschina.com>
>> ---
>>
>> I'm not sure that return directly is true or not, maybe need some
>> process before return directly.
>>
>>   drivers/phy/motorola/phy-mapphone-mdm6600.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
>> index 1d567604b650..e84e3390bff0 100644
>> --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
>> +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
>> @@ -421,8 +421,8 @@ static int phy_mdm6600_device_power_on(struct phy_mdm6600 *ddata)
>>   			dev_info(ddata->dev, "Powered up OK\n");
>>   	} else {
>>   		ddata->enabled = false;
>> -		error = -ETIMEDOUT;
>>   		dev_err(ddata->dev, "Timed out powering up\n");
>> +		return -ETIMEDOUT;
>>   	}
>>   
>>   	/* Reconfigure mode1 GPIO as input for OOB wake */
>> -- 
>> 2.30.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-17  1:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  9:14 [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Su Hui
2023-10-20  9:14 ` [PATCH 2/2] phy: mapphone-mdm6600: fix an error code problem in inv_mpu6050_read_raw Su Hui
2023-10-20 15:55   ` Jonathan Cameron
2023-10-23  1:33     ` Su Hui
2023-10-23  3:29       ` Su Hui
2023-11-16 11:26 ` [PATCH 1/2] phy: mapphone-mdm6600: fix an error code problem in phy_mdm6600_device_power_on Vinod Koul
2023-11-17  1:22   ` Su Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox