mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeny Novikov <novikov@ispras.ru>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Kirill Shilimanov <kirill.shilimanov@huawei.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ldv-project@linuxtesting.org" <ldv-project@linuxtesting.org>
Subject: Re: [PATCH] mtd: rawnand: mxic: Enable and prepare clocks in probe
Date: Tue, 17 Aug 2021 13:36:03 +0300	[thread overview]
Message-ID: <246f2094-e294-73f8-8a5f-3467e987f788@ispras.ru> (raw)
In-Reply-To: <20210816100114.384f01b9@xps13>

Hi Miquel,

On 16.08.2021 11:01, Miquel Raynal wrote:
> Hi Andy,
>
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote on Thu, 12 Aug 2021
> 15:13:10 +0300:
>
>> On Thursday, August 12, 2021, Evgeny Novikov <novikov@ispras.ru> wrote:
>>
>>> It seems that mxic_nfc_probe() missed invocation of
>>> mxic_nfc_clk_enable(). The patch fixed that. In addition, error handling
>>> was refined appropriately.
>>
>> NAK. Until you provide a deeper analysis, like how this works before your
>> change.
>>
>>
>> Please, don’t blindly generate patches, this can even your bot do, just
>> think about each change and preferable test on the real hardware.
>>
>> The above is to all your lovely contributions.
>>
>>
>>> Found by Linux Driver Verification project (linuxtesting.org).
>>>
>>> Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
>>> Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
>>> Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
>>> ---
>>>   drivers/mtd/nand/raw/mxic_nand.c | 16 ++++++++++++----
>>>   1 file changed, 12 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_
>>> nand.c
>>> index da1070993994..37e75bf60ee5 100644
>>> --- a/drivers/mtd/nand/raw/mxic_nand.c
>>> +++ b/drivers/mtd/nand/raw/mxic_nand.c
>>> @@ -509,9 +509,15 @@ static int mxic_nfc_probe(struct platform_device
>>> *pdev)
>>>          if (IS_ERR(nfc->send_dly_clk))
>>>                  return PTR_ERR(nfc->send_dly_clk);
>>>
>>> +       err = mxic_nfc_clk_enable(nfc);
>>> +       if (err)
>>> +               return err;
> As Andy said, this is not needed.
>
>>> +
>>>          nfc->regs = devm_platform_ioremap_resource(pdev, 0);
>>> -       if (IS_ERR(nfc->regs))
>>> -               return PTR_ERR(nfc->regs);
>>> +       if (IS_ERR(nfc->regs)) {
>>> +               err = PTR_ERR(nfc->regs);
>>> +               goto fail;
>>> +       }
>>>
>>>          nand_chip = &nfc->chip;
>>>          mtd = nand_to_mtd(nand_chip);
>>> @@ -527,8 +533,10 @@ static int mxic_nfc_probe(struct platform_device
>>> *pdev)
>>>          nand_chip->controller = &nfc->controller;
>>>
>>>          irq = platform_get_irq(pdev, 0);
>>> -       if (irq < 0)
>>> -               return irq;
>>> +       if (irq < 0) {
>>> +               err = irq;
>>> +               goto fail;
> However some reworking is needed in the error path.
>
> That goto statement should be renamed and devm_request_irq() should not
> jump to it.
>

We still need some help and clarification from those who are very 
familiar with this sort of drivers or/and can test this particular 
driver. mxic_nfc_clk_enable() is the complementary function for 
mxic_nfc_clk_disable(). No other functions invoke 
clk_prepare_enable()/clk_disable_unprepare() in the driver. Unlikely 
somebody in its environment does that since driver specific clocks are 
dealt with. At the moment the driver invokes mxic_nfc_clk_disable() on 
error handling paths in probe, in remove and in mxic_nfc_set_freq(). 
mxic_nfc_clk_enable() is called just by mxic_nfc_set_freq() that 
moreover does this after calling mxic_nfc_clk_disable() first. So, we 
did not find any place in the driver that invokes mxic_nfc_clk_enable() 
prior to mxic_nfc_clk_disable(). Basing on this we added 
mxic_nfc_clk_enable() just after getting clocks. As I explained in the 
previous large e-mail, we may be wrong in our understanding of the 
driver environment or/and at specification of requirements being 
checked. It would be great if you will point out on our mistakes.

Best regards,
Evgeny Novikov
>>> +       }
>>>
>>>          mxic_nfc_hw_init(nfc);
>>>
>>> --
>>> 2.26.2
>>>
>>>   
> Thanks,
> Miquèl

  reply	other threads:[~2021-08-17 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 11:38 Evgeny Novikov
     [not found] ` <CAHp75VcgqZEHBTXpNApGfRkhgjpCvbgj+yxUZbbO+=0DOvZLQg@mail.gmail.com>
2021-08-16  8:01   ` Miquel Raynal
2021-08-17 10:36     ` Evgeny Novikov [this message]
2021-08-17 10:55       ` Miquel Raynal
2021-08-17 10:59         ` Miquel Raynal
2021-08-26  5:09           ` ycllin
2021-08-17  9:08   ` Evgeny Novikov
2021-08-17 11:47     ` Andy Shevchenko
2021-08-21 17:26       ` Evgeny Novikov
2021-08-22  8:27         ` Andy Shevchenko

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=246f2094-e294-73f8-8a5f-3467e987f788@ispras.ru \
    --to=novikov@ispras.ru \
    --cc=andy.shevchenko@gmail.com \
    --cc=kirill.shilimanov@huawei.com \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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

all inboxes | Powered by JetHome®