From: Chanwoo Choi <cw00.choi@samsung.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: a.zummo@towertech.it, kgene.kim@samsung.com,
kyungmin.park@samsung.com, rtc-linux@googlegroups.com,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCHv2 1/5] rtc: s3c: Define s3c_rtc structure to remove global variables.
Date: Thu, 28 Aug 2014 13:49:25 +0900 [thread overview]
Message-ID: <53FEB4D5.8000704@samsung.com> (raw)
In-Reply-To: <20140826143149.7cd3ab27b6247a59a486e681@linux-foundation.org>
Dear Andrew,
On 08/27/2014 06:31 AM, Andrew Morton wrote:
> On Mon, 25 Aug 2014 09:57:33 +0900 Chanwoo Choi <cw00.choi@samsung.com> wrote:
>
>> Dear Andrew,
>>
>> On 08/23/2014 05:42 AM, Andrew Morton wrote:
>>> On Tue, 12 Aug 2014 11:01:07 +0900 y@samsung.com wrote:
>>>
>>>> This patch define s3c_rtc structure including necessary variables for S3C RTC
>>>> device instead of global variables. This patch improves the readability by
>>>> removing global variables.
>>>
>>> Below is the v1->v2 delta.
>>>
>>> Why were all those tests of info->base added? Can it really be zero?
>>> I don't see how.
>>
>> If some functions (e.g., s3c_rtc_settime) accesses the rtc register
>> by using info->base before the initialization of info->base in s3c_rtc_probe,
>> I thought that null pointer error would happen.
>
> probe() should be called before anything else. If we're somehow
> calling s3c_rtc_settime() before probe() has completed then something
> very bad is happening - for example, the device may have been
> registered far too early. But I don't think that's the case here.
I means that existing rtc-s3c.c driver executed s3c_rtc_settime() in s3c_rtc_probe()
before initialization of info->base. But, It is my mistake. so, I modified it just as following:
- s3c_rtc_settime(NULL, &rtc_tm);
+ s3c_rtc_settime(&pdev->dev, &rtc_tm);
>
> That being said, it does seem strange that s3c_rtc_probe() calls
> devm_rtc_device_register() *before* trying to request its IRQs. So if
> IRQ requesting fails, we go and immediately unregister the device.
> Some other drivers do it this way, others do not. Wouldn't it be
> better to defer registration until we know that all the probe() setup
> operations have succeeded?
You're right. I missed this point. If rtc-s3c.c driver completed the probe function,
info->base has always right address.
+ if (!info->base)
+ return -EINVAL;
+
As you said, checking state of 'info-base' is un-needed.
I'll send new patchset(v3) to fix it.
>
>> But, I missed one point which info->base might have the garbate data instead of NULL.
>> I'll add the initialization code for info->base.
>> info->base = NULL;
>>
>> If you don't agree it, I'll drop this code checking the state of info->base on next patchset(v3).
>
> Well, we should have those checks in there unless we know they're
> needed. And if they *are* needed, we should have a good understanding
> of why they're needed, and we should be sure that we're not just
> working around some underlying problem.
You are right. Thanks for your comment and advice.
Best Regards,
Chanwoo Choi
next prev parent reply other threads:[~2014-08-28 4:49 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <y@samsung.com>
2012-05-22 5:57 ` [PATCH v3 2/2] regulator: Add support for MAX77686 yadi.brar01
2012-05-23 1:40 ` jonghwa3.lee
2012-05-23 4:16 ` Yadwinder Singh Brar
2012-05-23 4:40 ` jonghwa3.lee
2012-05-23 5:23 ` Yadwinder Singh Brar
2012-05-23 5:33 ` jonghwa3.lee
2012-05-23 10:18 ` Mark Brown
2012-05-23 13:02 ` Yadwinder Singh Brar
2012-05-23 6:08 ` Yadwinder Singh Brar
2012-05-23 1:50 ` jonghwa3.lee
2012-05-23 4:17 ` Yadwinder Singh Brar
2014-07-23 1:40 ` [PATCH] extcon: Add missing REGMAP_I2C/REGMAP_IRQ dependency on extcon driver Chanwoo Choi
2014-07-23 8:20 ` Krzysztof Kozlowski
2014-07-25 8:39 ` Charles Keepax
2014-08-12 2:01 ` [PATCHv2 0/5] rtc: s3c: Refactoring s3c-rtc driver and support Exynos3250 RTC y
2014-08-12 2:01 ` [PATCHv2 1/5] rtc: s3c: Define s3c_rtc structure to remove global variables y
2014-08-22 20:42 ` Andrew Morton
2014-08-25 0:57 ` Chanwoo Choi
2014-08-26 21:31 ` Andrew Morton
2014-08-28 4:49 ` Chanwoo Choi [this message]
2014-08-12 2:01 ` [PATCHv2 2/5] rtc: s3c: Remove warning message when checking coding style with checkpatch script y
2014-08-12 2:01 ` [PATCHv2 3/5] rtc: s3c: Add s3c_rtc_data structure to use variant data instead of s3c_cpu_type y
2014-08-12 2:01 ` [PATCHv2 4/5] rtc: s3c: Add support for RTC of Exynos3250 SoC y
2014-08-12 2:01 ` [PATCHv2 5/5] ARM: dts: Fix wrong compatible string of Exynos3250 RTC dt node y
2015-12-01 9:13 ` [PATCH 3/6] net: thunderx: Increase transmit queue length Sunil Goutham
2015-12-01 14:40 ` Pavel Fedin
2015-12-01 15:33 ` Eric Dumazet
2015-12-01 16:30 ` Sunil Kovvuri
2015-12-01 19:30 ` David Miller
2015-12-02 5:48 ` Sunil Kovvuri
2015-12-02 13:25 ` Eric Dumazet
2015-12-02 16:50 ` Sunil Kovvuri
2015-12-02 16:59 ` Eric Dumazet
2015-12-02 17:31 ` David Miller
2015-12-02 9:05 ` Pavel Fedin
2015-12-02 10:31 ` Pavel Fedin
2015-12-02 12:29 ` Pavel Fedin
2015-12-02 12:57 ` Sunil Kovvuri
2015-12-02 13:22 ` Pavel Fedin
2015-12-02 8:09 ` Pavel Fedin
2015-12-01 9:13 ` [PATCH 5/6] net: thunderx: Switchon carrier only upon interface link up Sunil Goutham
2015-12-01 15:32 ` Pavel Fedin
2015-12-01 16:39 ` Sunil Kovvuri
2015-12-07 5:00 ` [PATCH 0/2] net: thunderx: Miscellaneous cleanups Sunil Goutham
2015-12-07 10:33 ` Pavel Fedin
2015-12-07 18:40 ` David Miller
2015-12-09 11:38 ` [PATCH 1/2] net: thunderx: HW TSO support for pass-2 hardware Sunil Goutham
2015-12-09 12:05 ` Pavel Fedin
2015-12-09 12:24 ` Sunil Kovvuri
2015-12-09 20:26 ` David Miller
2015-12-09 11:38 ` [PATCH 2/2] net: thunderx: Enable CQE count threshold interrupt Sunil Goutham
2015-12-09 12:07 ` Pavel Fedin
2015-12-09 12:26 ` Sunil Kovvuri
2015-12-10 7:55 ` [PATCH v2 0/2] net: thunderx: Support for pass-2 hw features Sunil Goutham
2015-12-10 8:52 ` Pavel Fedin
2015-12-12 4:38 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53FEB4D5.8000704@samsung.com \
--to=cw00.choi@samsung.com \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.org \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).