* [rtc-linux] [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL
@ 2016-04-19 4:26 Gong Qianyu
2016-04-19 11:22 ` [rtc-linux] " Akinobu Mita
0 siblings, 1 reply; 3+ messages in thread
From: Gong Qianyu @ 2016-04-19 4:26 UTC (permalink / raw)
To: rtc-linux, akinobu.mita, alexandre.belloni; +Cc: mingkai.hu, Gong Qianyu
Move devm_rtc_device_register() just before registering irq handler
to initialize rtc->ops_lock earlier.
Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
---
drivers/rtc/rtc-ds3232.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 7edc889..9d44b2f 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -369,6 +369,8 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
if (ret)
return ret;
+ ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
+ THIS_MODULE);
if (ds3232->irq > 0) {
ret = devm_request_threaded_irq(dev, ds3232->irq, NULL,
ds3232_irq,
@@ -380,8 +382,6 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
} else
device_init_wakeup(dev, 1);
}
- ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
- THIS_MODULE);
return PTR_ERR_OR_ZERO(ds3232->rtc);
}
--
2.1.0.27.g96db324
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [rtc-linux] Re: [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL
2016-04-19 4:26 [rtc-linux] [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL Gong Qianyu
@ 2016-04-19 11:22 ` Akinobu Mita
2016-04-20 3:00 ` [rtc-linux] " Qianyu Gong
0 siblings, 1 reply; 3+ messages in thread
From: Akinobu Mita @ 2016-04-19 11:22 UTC (permalink / raw)
To: Gong Qianyu; +Cc: rtc-linux, Alexandre Belloni, Mingkai Hu
Hi Gong,
2016-04-19 13:26 GMT+09:00 Gong Qianyu <Qianyu.Gong@nxp.com>:
> Move devm_rtc_device_register() just before registering irq handler
> to initialize rtc->ops_lock earlier.
It is better to explain why you need this change in the commit log.
You already described it in your first report:
> The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> without being initialized as rtc_device_register() is called too late.
> Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
> ---
> drivers/rtc/rtc-ds3232.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
> index 7edc889..9d44b2f 100644
> --- a/drivers/rtc/rtc-ds3232.c
> +++ b/drivers/rtc/rtc-ds3232.c
> @@ -369,6 +369,8 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
> if (ret)
> return ret;
>
> + ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
> + THIS_MODULE);
> if (ds3232->irq > 0) {
> ret = devm_request_threaded_irq(dev, ds3232->irq, NULL,
> ds3232_irq,
> @@ -380,8 +382,6 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
> } else
> device_init_wakeup(dev, 1);
> }
> - ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
> - THIS_MODULE);
>
> return PTR_ERR_OR_ZERO(ds3232->rtc);
This error check for devm_rtc_device_register() needs to be moved together.
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [rtc-linux] RE: [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL
2016-04-19 11:22 ` [rtc-linux] " Akinobu Mita
@ 2016-04-20 3:00 ` Qianyu Gong
0 siblings, 0 replies; 3+ messages in thread
From: Qianyu Gong @ 2016-04-20 3:00 UTC (permalink / raw)
To: Akinobu Mita; +Cc: rtc-linux, Alexandre Belloni, Mingkai Hu
Hi Akinobu,
> -----Original Message-----
> From: Akinobu Mita [mailto:akinobu.mita@gmail.com]
> Sent: Tuesday, April 19, 2016 7:23 PM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: rtc-linux@googlegroups.com; Alexandre Belloni <alexandre.belloni@free-
> electrons.com>; Mingkai Hu <mingkai.hu@nxp.com>
> Subject: Re: [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL
>
> Hi Gong,
>
> 2016-04-19 13:26 GMT+09:00 Gong Qianyu <Qianyu.Gong@nxp.com>:
> > Move devm_rtc_device_register() just before registering irq handler to
> > initialize rtc->ops_lock earlier.
>
> It is better to explain why you need this change in the commit log.
> You already described it in your first report:
> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> > without being initialized as rtc_device_register() is called too late.
>
> > Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
> > ---
> > drivers/rtc/rtc-ds3232.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index
> > 7edc889..9d44b2f 100644
> > --- a/drivers/rtc/rtc-ds3232.c
> > +++ b/drivers/rtc/rtc-ds3232.c
> > @@ -369,6 +369,8 @@ static int ds3232_probe(struct device *dev, struct
> regmap *regmap, int irq,
> > if (ret)
> > return ret;
> >
> > + ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
> > + THIS_MODULE);
> > if (ds3232->irq > 0) {
> > ret = devm_request_threaded_irq(dev, ds3232->irq, NULL,
> > ds3232_irq, @@ -380,8
> > +382,6 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap,
> int irq,
> > } else
> > device_init_wakeup(dev, 1);
> > }
> > - ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
> > - THIS_MODULE);
> >
> > return PTR_ERR_OR_ZERO(ds3232->rtc);
>
> This error check for devm_rtc_device_register() needs to be moved together.
Ok. I also revise the return. Thanks.
Regards,
Qianyu
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-20 3:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 4:26 [rtc-linux] [PATCH] rtc: ds3232: fix call trace when rtc->ops_lock is used as NULL Gong Qianyu
2016-04-19 11:22 ` [rtc-linux] " Akinobu Mita
2016-04-20 3:00 ` [rtc-linux] " Qianyu Gong
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.