linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] power: qcom_smbb: test the correct variable
@ 2015-09-24 18:41 Dan Carpenter
  2015-09-24 19:50 ` Courtney Cavin
  2015-09-24 20:36 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-09-24 18:41 UTC (permalink / raw)
  To: Sebastian Reichel, Courtney Cavin
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm,
	kernel-janitors

"state" is a bool so it's never less than zero.  The intent was to test
"ret" instead.

Fixes: 56d7df8716b2 ('power: Add Qualcomm SMBB driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 0dabfe8..5eb1e9e 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -351,7 +351,7 @@ static void smbb_set_line_flag(struct smbb_charger *chg, int irq, int flag)
 	int ret;
 
 	ret = irq_get_irqchip_state(irq, IRQCHIP_STATE_LINE_LEVEL, &state);
-	if (state < 0) {
+	if (ret < 0) {
 		dev_err(chg->dev, "failed to read irq line\n");
 		return;
 	}

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

* Re: [patch] power: qcom_smbb: test the correct variable
  2015-09-24 18:41 [patch] power: qcom_smbb: test the correct variable Dan Carpenter
@ 2015-09-24 19:50 ` Courtney Cavin
  2015-09-24 20:36 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Courtney Cavin @ 2015-09-24 19:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org

On Thu, Sep 24, 2015 at 08:41:37PM +0200, Dan Carpenter wrote:
> "state" is a bool so it's never less than zero.  The intent was to test
> "ret" instead.
> 
> Fixes: 56d7df8716b2 ('power: Add Qualcomm SMBB driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
> index 0dabfe8..5eb1e9e 100644
> --- a/drivers/power/qcom_smbb.c
> +++ b/drivers/power/qcom_smbb.c
> @@ -351,7 +351,7 @@ static void smbb_set_line_flag(struct smbb_charger *chg, int irq, int flag)
>  	int ret;
>  
>  	ret = irq_get_irqchip_state(irq, IRQCHIP_STATE_LINE_LEVEL, &state);
> -	if (state < 0) {
> +	if (ret < 0) {
>  		dev_err(chg->dev, "failed to read irq line\n");
>  		return;
>  	}

Hrm.  This must be a leftover from when this was using Bjorn's
irq_read_line().  Thanks!

I guess you caught this with smatch?  Neither sparse nor gcc give me a
warning here, which is disappointing.

-Courtney

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

* Re: [patch] power: qcom_smbb: test the correct variable
  2015-09-24 18:41 [patch] power: qcom_smbb: test the correct variable Dan Carpenter
  2015-09-24 19:50 ` Courtney Cavin
@ 2015-09-24 20:36 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2015-09-24 20:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Courtney Cavin, Dmitry Eremin-Solenikov, David Woodhouse,
	linux-pm, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hi,

On Thu, Sep 24, 2015 at 09:41:37PM +0300, Dan Carpenter wrote:
> "state" is a bool so it's never less than zero.  The intent was to test
> "ret" instead.
> 
> Fixes: 56d7df8716b2 ('power: Add Qualcomm SMBB driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, queued.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-09-24 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 18:41 [patch] power: qcom_smbb: test the correct variable Dan Carpenter
2015-09-24 19:50 ` Courtney Cavin
2015-09-24 20:36 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).