* [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
@ 2020-05-06 10:11 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-06 10:11 UTC (permalink / raw)
To: Sebastian Reichel, Michał Mirosław; +Cc: linux-pm, kernel-janitors
We introduced some new locking here, but need to update the error
paths so they unlock before returning.
Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/power/supply/bq25890_charger.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 9339e216651ff..20b9824ef5acd 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
ret = bq25890_get_chip_state(bq, &bq->state);
if (ret < 0)
- return ret;
+ goto unlock;
/* Re-enable ADC only if charger is plugged in. */
if (bq->state.online) {
ret = bq25890_field_write(bq, F_CONV_START, 1);
if (ret < 0)
- return ret;
+ goto unlock;
}
/* signal userspace, maybe state changed while suspended */
power_supply_changed(bq->charger);
+unlock:
mutex_unlock(&bq->lock);
- return 0;
+ return ret;
}
#endif
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
@ 2020-05-06 10:11 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-06 10:11 UTC (permalink / raw)
To: Sebastian Reichel, Michał Mirosław; +Cc: linux-pm, kernel-janitors
We introduced some new locking here, but need to update the error
paths so they unlock before returning.
Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/power/supply/bq25890_charger.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 9339e216651ff..20b9824ef5acd 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
ret = bq25890_get_chip_state(bq, &bq->state);
if (ret < 0)
- return ret;
+ goto unlock;
/* Re-enable ADC only if charger is plugged in. */
if (bq->state.online) {
ret = bq25890_field_write(bq, F_CONV_START, 1);
if (ret < 0)
- return ret;
+ goto unlock;
}
/* signal userspace, maybe state changed while suspended */
power_supply_changed(bq->charger);
+unlock:
mutex_unlock(&bq->lock);
- return 0;
+ return ret;
}
#endif
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
2020-05-06 10:11 ` Dan Carpenter
@ 2020-05-06 12:20 ` Michał Mirosław
-1 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2020-05-06 12:20 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Sebastian Reichel, linux-pm, kernel-janitors
On Wed, May 06, 2020 at 01:11:16PM +0300, Dan Carpenter wrote:
> We introduced some new locking here, but need to update the error
> paths so they unlock before returning.
Reviewed-by: Micha³ Miros³aw <mirq-linux@rere.qmqm.pl>
> Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/power/supply/bq25890_charger.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index 9339e216651ff..20b9824ef5acd 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
>
> ret = bq25890_get_chip_state(bq, &bq->state);
> if (ret < 0)
> - return ret;
> + goto unlock;
>
> /* Re-enable ADC only if charger is plugged in. */
> if (bq->state.online) {
> ret = bq25890_field_write(bq, F_CONV_START, 1);
> if (ret < 0)
> - return ret;
> + goto unlock;
> }
>
> /* signal userspace, maybe state changed while suspended */
> power_supply_changed(bq->charger);
>
> +unlock:
> mutex_unlock(&bq->lock);
>
> - return 0;
> + return ret;
> }
> #endif
>
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
@ 2020-05-06 12:20 ` Michał Mirosław
0 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2020-05-06 12:20 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Sebastian Reichel, linux-pm, kernel-janitors
On Wed, May 06, 2020 at 01:11:16PM +0300, Dan Carpenter wrote:
> We introduced some new locking here, but need to update the error
> paths so they unlock before returning.
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/power/supply/bq25890_charger.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index 9339e216651ff..20b9824ef5acd 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
>
> ret = bq25890_get_chip_state(bq, &bq->state);
> if (ret < 0)
> - return ret;
> + goto unlock;
>
> /* Re-enable ADC only if charger is plugged in. */
> if (bq->state.online) {
> ret = bq25890_field_write(bq, F_CONV_START, 1);
> if (ret < 0)
> - return ret;
> + goto unlock;
> }
>
> /* signal userspace, maybe state changed while suspended */
> power_supply_changed(bq->charger);
>
> +unlock:
> mutex_unlock(&bq->lock);
>
> - return 0;
> + return ret;
> }
> #endif
>
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
2020-05-06 12:20 ` Michał Mirosław
@ 2020-05-09 0:15 ` Sebastian Reichel
-1 siblings, 0 replies; 6+ messages in thread
From: Sebastian Reichel @ 2020-05-09 0:15 UTC (permalink / raw)
To: Michał Mirosław; +Cc: Dan Carpenter, linux-pm, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]
Hi,
On Wed, May 06, 2020 at 02:20:20PM +0200, Michał Mirosław wrote:
> On Wed, May 06, 2020 at 01:11:16PM +0300, Dan Carpenter wrote:
> > We introduced some new locking here, but need to update the error
> > paths so they unlock before returning.
>
> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Thanks, queued.
-- Sebastian
> > Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/power/supply/bq25890_charger.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> > index 9339e216651ff..20b9824ef5acd 100644
> > --- a/drivers/power/supply/bq25890_charger.c
> > +++ b/drivers/power/supply/bq25890_charger.c
> > @@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
> >
> > ret = bq25890_get_chip_state(bq, &bq->state);
> > if (ret < 0)
> > - return ret;
> > + goto unlock;
> >
> > /* Re-enable ADC only if charger is plugged in. */
> > if (bq->state.online) {
> > ret = bq25890_field_write(bq, F_CONV_START, 1);
> > if (ret < 0)
> > - return ret;
> > + goto unlock;
> > }
> >
> > /* signal userspace, maybe state changed while suspended */
> > power_supply_changed(bq->charger);
> >
> > +unlock:
> > mutex_unlock(&bq->lock);
> >
> > - return 0;
> > + return ret;
> > }
> > #endif
> >
> > --
> > 2.26.2
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] power: bq25890: unlock on error paths in bq25890_resume()
@ 2020-05-09 0:15 ` Sebastian Reichel
0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Reichel @ 2020-05-09 0:15 UTC (permalink / raw)
To: Michał Mirosław; +Cc: Dan Carpenter, linux-pm, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]
Hi,
On Wed, May 06, 2020 at 02:20:20PM +0200, Michał Mirosław wrote:
> On Wed, May 06, 2020 at 01:11:16PM +0300, Dan Carpenter wrote:
> > We introduced some new locking here, but need to update the error
> > paths so they unlock before returning.
>
> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Thanks, queued.
-- Sebastian
> > Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/power/supply/bq25890_charger.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> > index 9339e216651ff..20b9824ef5acd 100644
> > --- a/drivers/power/supply/bq25890_charger.c
> > +++ b/drivers/power/supply/bq25890_charger.c
> > @@ -978,21 +978,22 @@ static int bq25890_resume(struct device *dev)
> >
> > ret = bq25890_get_chip_state(bq, &bq->state);
> > if (ret < 0)
> > - return ret;
> > + goto unlock;
> >
> > /* Re-enable ADC only if charger is plugged in. */
> > if (bq->state.online) {
> > ret = bq25890_field_write(bq, F_CONV_START, 1);
> > if (ret < 0)
> > - return ret;
> > + goto unlock;
> > }
> >
> > /* signal userspace, maybe state changed while suspended */
> > power_supply_changed(bq->charger);
> >
> > +unlock:
> > mutex_unlock(&bq->lock);
> >
> > - return 0;
> > + return ret;
> > }
> > #endif
> >
> > --
> > 2.26.2
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-09 0:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 10:11 [PATCH] power: bq25890: unlock on error paths in bq25890_resume() Dan Carpenter
2020-05-06 10:11 ` Dan Carpenter
2020-05-06 12:20 ` Michał Mirosław
2020-05-06 12:20 ` Michał Mirosław
2020-05-09 0:15 ` Sebastian Reichel
2020-05-09 0:15 ` Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.