diff mbox series

usb: typec: tcpm/tcpci_maxim: fix error code in max_contaminant_read_resistance_kohm()

Message ID f1bf3768-419e-40dd-989c-f7f455d6c824@stanley.mountain (mailing list archive)
State New
Headers show
Series usb: typec: tcpm/tcpci_maxim: fix error code in max_contaminant_read_resistance_kohm() | expand

Commit Message

Dan Carpenter Dec. 6, 2024, 1:09 p.m. UTC
If max_contaminant_read_adc_mv() fails, then return the error code.  Don't
return zero.

Fixes: 02b332a06397 ("usb: typec: maxim_contaminant: Implement check_contaminant callback")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/usb/typec/tcpm/maxim_contaminant.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

André Draszik Dec. 9, 2024, 10:06 a.m. UTC | #1
On Fri, 2024-12-06 at 16:09 +0300, Dan Carpenter wrote:
> If max_contaminant_read_adc_mv() fails, then return the error code.  Don't
> return zero.
> 
> Fixes: 02b332a06397 ("usb: typec: maxim_contaminant: Implement check_contaminant callback")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Reviewed-by: André Draszik <andre.draszik@linaro.org>
Heikki Krogerus Dec. 11, 2024, 9:18 a.m. UTC | #2
On Fri, Dec 06, 2024 at 04:09:18PM +0300, Dan Carpenter wrote:
> If max_contaminant_read_adc_mv() fails, then return the error code.  Don't
> return zero.
> 
> Fixes: 02b332a06397 ("usb: typec: maxim_contaminant: Implement check_contaminant callback")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/maxim_contaminant.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/maxim_contaminant.c b/drivers/usb/typec/tcpm/maxim_contaminant.c
> index 22163d8f9eb0..0cdda06592fd 100644
> --- a/drivers/usb/typec/tcpm/maxim_contaminant.c
> +++ b/drivers/usb/typec/tcpm/maxim_contaminant.c
> @@ -135,7 +135,7 @@ static int max_contaminant_read_resistance_kohm(struct max_tcpci_chip *chip,
>  
>  		mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true);
>  		if (mv < 0)
> -			return ret;
> +			return mv;
>  
>  		/* OVP enable */
>  		ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCOVPDIS, 0);
> @@ -157,7 +157,7 @@ static int max_contaminant_read_resistance_kohm(struct max_tcpci_chip *chip,
>  
>  	mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true);
>  	if (mv < 0)
> -		return ret;
> +		return mv;
>  	/* Disable current source */
>  	ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, SBURPCTRL, 0);
>  	if (ret < 0)
> -- 
> 2.45.2
diff mbox series

Patch

diff --git a/drivers/usb/typec/tcpm/maxim_contaminant.c b/drivers/usb/typec/tcpm/maxim_contaminant.c
index 22163d8f9eb0..0cdda06592fd 100644
--- a/drivers/usb/typec/tcpm/maxim_contaminant.c
+++ b/drivers/usb/typec/tcpm/maxim_contaminant.c
@@ -135,7 +135,7 @@  static int max_contaminant_read_resistance_kohm(struct max_tcpci_chip *chip,
 
 		mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true);
 		if (mv < 0)
-			return ret;
+			return mv;
 
 		/* OVP enable */
 		ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCOVPDIS, 0);
@@ -157,7 +157,7 @@  static int max_contaminant_read_resistance_kohm(struct max_tcpci_chip *chip,
 
 	mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true);
 	if (mv < 0)
-		return ret;
+		return mv;
 	/* Disable current source */
 	ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, SBURPCTRL, 0);
 	if (ret < 0)