Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@auroraos.dev>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulfh@kernel.org>, <linux-mmc@vger.kernel.org>
Cc: Jisheng Zhang <jszhang@kernel.org>
Subject: Re: [PATCH v2] mmc: sdhci-of-dwcmshc: check bus clock enable result in the, probe() method
Date: Mon, 1 Jun 2026 10:51:42 +0300	[thread overview]
Message-ID: <aba25e4b-0eca-4200-ae0f-9afabb989155@auroraos.dev> (raw)
In-Reply-To: <a3068d05-4568-4a06-b51c-b4bd7dc2db4c@intel.com>

On 6/1/26 10:43 AM, Adrian Hunter wrote:

> On 29/05/2026 23:28, Sergey Shtylyov wrote:
>> In the driver's probe() method, clk_disable_unprepare() for the bus clock
>> is called on the error path even if the prior clk_prepare_enable() call has
>> failed (and the same thing happens in the remove() method as well) -- that
>> would cause the prepare/enable counter imbalance.  Also, the same problem
> 
> Doesn't clk_disable_unprepare() do nothing if clk is IS_ERR_OR_NULL()?

   Yes, I does. But my patch is not about this case, it's about the case when
clk_prepare_enable() for the bus clock fails...
 
>> can happen in the driver's suspend() method; note that the resume() method
>> does check the clk_prepare_enable()'s result -- let's be consistent and do
>> that in probe() method as well.  BTW, I don't know for sure what does the
>> bus clock control -- if it affects the register accesses, the driver will
>> likely to cause (e.g. on ARM) a kernel oops if it fails to prepare/enable
>> the bus clock in the probe() method...
>>
>> Found by Linux Verification Center (linuxtesting.org) with the Svace static
>> analysis tool.
>>
>> Fixes: e438cf49b305 ("mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC driver")
>> Fixes: bccce2ec7790 ("mmc: sdhci-of-dwcmshc: add suspend/resume support")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>

[...]

MBR, Sergey


  reply	other threads:[~2026-06-01  7:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 20:28 [PATCH v2] mmc: sdhci-of-dwcmshc: check bus clock enable result in the, probe() method Sergey Shtylyov
2026-05-30 19:03 ` Sergey Shtylyov
2026-06-01  7:43 ` Adrian Hunter
2026-06-01  7:51   ` Sergey Shtylyov [this message]
2026-06-01  9:19 ` Adrian Hunter
2026-06-01 14:01   ` Sergey Shtylyov

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=aba25e4b-0eca-4200-ae0f-9afabb989155@auroraos.dev \
    --to=s.shtylyov@auroraos.dev \
    --cc=adrian.hunter@intel.com \
    --cc=jszhang@kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /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