LKML Archive mirror
 help / color / mirror / Atom feed
From: Raymond Hackley <raymondhackley@protonmail.com>
To: krzysztof.kozlowski@linaro.org
Cc: broonie@kernel.org, davem@davemloft.net,
	devicetree@vger.kernel.org, edumazet@google.com,
	jk@codeconstruct.com.au, kuba@kernel.org, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, michael@walle.cc,
	netdev@vger.kernel.org, pabeni@redhat.com,
	raymondhackley@protonmail.com, robh+dt@kernel.org,
	u.kleine-koenig@pengutronix.de
Subject: Re: [PATCH v2 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply
Date: Fri, 09 Jun 2023 20:44:00 +0000	[thread overview]
Message-ID: <20230609204329.105189-1-raymondhackley@protonmail.com> (raw)
In-Reply-To: <7ad5d027-9b15-f59e-aa76-17e498cb7aba@linaro.org>

Hi Krzysztof,

On Friday, June 9th, 2023 at 7:29 PM, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> > > Why do you need these checks? This should be called in correct context,
> > > so when regulator is valid and enabled. If you have such checks it
> > > suggests that code is buggy and this is being called in wrong contexts.
> > 
> > First condition !IS_ERR(pvdd) is to check if pvdd exists.
> > Some devices, msm8916-samsung-serranove for example, doesn't need pvdd or
> > have it bound in the device tree:
> 
> 
> If regulator is missing you should get a dummy.
> 
> But anyway the code will not be executed if you don't get proper regulator.
> 

The current patch set is using devm_regulator_get_optional() instead of
devm_regulator_get(), which doesn't get a dummy regulator.

> > https://github.com/torvalds/linux/commit/ab0f0987e035f908d670fed7d86efa6fac66c0bb
> > 
> > Without !IS_ERR(pvdd), checking it with regulator_is_enabled(pvdd):
> > 
> > [ 50.161882] 8<--- cut here ---
> > [ 50.161906] Unable to handle kernel paging request at virtual address fffffff9 when read
> > [ 50.161916] [fffffff9] *pgd=affff841, *pte=00000000, *ppte=00000000
> > [ 50.161938] Internal error: Oops: 27 [#1] PREEMPT SMP ARM
> > 
> > Or disabling it directly with regulator_disable(pvdd):
> > 
> > [ 69.439827] 8<--- cut here ---
> > [ 69.439841] Unable to handle kernel NULL pointer dereference at virtual address 00000045 when read
> > [ 69.439852] [00000045] *pgd=00000000
> > [ 69.439864] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> > 
> > Second condition regulator_is_enabled(pvdd) is to make sure that pvdd is
> > disabled with balance.
> 
> 
> So you have buggy code and to hide the bug you add checks? No, make the
> code correct so the check is not needed.
> 

Do you mean that I should use devm_regulator_get() instead in order to get
a dummy regulator, so that it can disable pvdd without unnecessary checks?
Actually there is v4 with those buggy codes and checks dropped.
Please do let me know if I am understanding and doing it correctly. I would
send it after proper period of cooldown.

Regards,
Raymond


      parent reply	other threads:[~2023-06-09 20:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 15:41 [PATCH v2 0/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley
2023-06-09 15:42 ` [PATCH v2 1/2] dt-bindings: nfc: nxp-nci: document pvdd-supply Raymond Hackley
2023-06-09 15:42 ` [PATCH v2 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply Raymond Hackley
2023-06-09 15:46   ` Krzysztof Kozlowski
2023-06-09 17:40     ` Raymond Hackley
2023-06-09 19:29       ` Krzysztof Kozlowski
2023-06-09 19:34         ` Mark Brown
2023-06-09 20:52           ` Raymond Hackley
2023-06-09 20:44         ` Raymond Hackley [this message]

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=20230609204329.105189-1-raymondhackley@protonmail.com \
    --to=raymondhackley@protonmail.com \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jk@codeconstruct.com.au \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kuba@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).