public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Gautam <vivek.gautam@codeaurora.org>
To: Manu Gautam <mgautam@codeaurora.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm-owner@vger.kernel.org
Subject: Re: [PATCH] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy
Date: Mon, 19 Mar 2018 14:17:22 +0530	[thread overview]
Message-ID: <a34e1f1038e667e0ee9a568e7b8ff3ce@codeaurora.org> (raw)
In-Reply-To: <1521191452-30089-1-git-send-email-mgautam@codeaurora.org>

On 2018-03-16 14:40, Manu Gautam wrote:
> phy_init() and phy_exit() calls, and phy_power_on() and
> phy_power_off() already accept NULL as valid PHY refernece
> and act as NOP. Extend same concept to phy runtime_pm APIs
> to keep drivers (e.g. dwc3) code simple while dealing with
> optional PHYs.
> 
> Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
> ---
>  drivers/phy/phy-core.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 09ac8af..48b9615 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy)
>  {
>  	int ret;
> 
> +	if (!phy)
> +		return 0;
> +
>  	if (!pm_runtime_enabled(&phy->dev))

Were we already trying to dereference a NULL here?
That shouldn't be good i guess.
Kishon, do we not expect phys to be NULL here?

<snip>

regards
Vivek

      parent reply	other threads:[~2018-03-19  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  9:10 [PATCH] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Manu Gautam
2018-03-17  4:35 ` kbuild test robot
2018-03-19  8:47 ` Vivek Gautam [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=a34e1f1038e667e0ee9a568e7b8ff3ce@codeaurora.org \
    --to=vivek.gautam@codeaurora.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-msm-owner@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgautam@codeaurora.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