diff mbox series

hwmon: pmbus: pxe1610: don't bail out when not all pages are active

Message ID 20210415133535.11171-1-fercerpav@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series hwmon: pmbus: pxe1610: don't bail out when not all pages are active | expand

Commit Message

Paul Fertser April 15, 2021, 1:34 p.m. UTC
Certain VRs might be configured to use only the first output channel and
so the mode for the second will be 0. Handle this gracefully.

Fixes: b9fa0a3acfd8 ("hwmon: (pmbus/core) Add support for vid mode detection per page bases")
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/hwmon/pmbus/pxe1610.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Guenter Roeck April 15, 2021, 3:18 p.m. UTC | #1
On 4/15/21 6:34 AM, Paul Fertser wrote:
> Certain VRs might be configured to use only the first output channel and
> so the mode for the second will be 0. Handle this gracefully.
> 
> Fixes: b9fa0a3acfd8 ("hwmon: (pmbus/core) Add support for vid mode detection per page bases")
> Signed-off-by: Paul Fertser <fercerpav@gmail.com>
> ---
>  drivers/hwmon/pmbus/pxe1610.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
> index 517584cff3de..ff6f6e05923b 100644
> --- a/drivers/hwmon/pmbus/pxe1610.c
> +++ b/drivers/hwmon/pmbus/pxe1610.c
> @@ -41,7 +41,16 @@ static int pxe1610_identify(struct i2c_client *client,
>  				info->vrm_version[i] = vr13;
>  				break;
>  			default:
> -				return -ENODEV;
> +				/*
> +				 * If prior pages are available limit operation
> +				 * to them
> +				 */
> +				if (i != 0) {
> +					info->pages = i;
> +					return 0;
> +				} else {
> +					return -ENODEV;
> +				}

else after return is unnecessary.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
index 517584cff3de..ff6f6e05923b 100644
--- a/drivers/hwmon/pmbus/pxe1610.c
+++ b/drivers/hwmon/pmbus/pxe1610.c
@@ -41,7 +41,16 @@  static int pxe1610_identify(struct i2c_client *client,
 				info->vrm_version[i] = vr13;
 				break;
 			default:
-				return -ENODEV;
+				/*
+				 * If prior pages are available limit operation
+				 * to them
+				 */
+				if (i != 0) {
+					info->pages = i;
+					return 0;
+				} else {
+					return -ENODEV;
+				}
 			}
 		}
 	}