devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jishnu Prakash <quic_jprakash@quicinc.com>
Cc: agross@kernel.org, bjorn.andersson@linaro.org,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	linus.walleij@linaro.org, quic_kamalw@quicinc.com,
	quic_jestar@quicinc.com, sboyd@kernel.org,
	quic_subbaram@quicinc.com, quic_collinsd@quicinc.com,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-msm-owner@vger.kernel.org
Subject: Re: [PATCH] spmi: Add check for remove callback in spmi_drv_remove API
Date: Tue, 13 Dec 2022 13:04:00 +0100	[thread overview]
Message-ID: <Y5hqMFw0xl6lmJYL@kroah.com> (raw)
In-Reply-To: <1670145780-13111-2-git-send-email-quic_jprakash@quicinc.com>

On Sun, Dec 04, 2022 at 02:53:00PM +0530, Jishnu Prakash wrote:
> Add a check for remove callback presence before calling it for a
> spmi driver, to avoid NULL pointer dereference error if remove callback
> has not been specified for that SPMI driver.
> 
> Signed-off-by: Jishnu Prakash <quic_jprakash@quicinc.com>
> ---
>  drivers/spmi/spmi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
> index a456ce5..6b34356 100644
> --- a/drivers/spmi/spmi.c
> +++ b/drivers/spmi/spmi.c
> @@ -350,7 +350,8 @@ static void spmi_drv_remove(struct device *dev)
>  	const struct spmi_driver *sdrv = to_spmi_driver(dev->driver);
>  
>  	pm_runtime_get_sync(dev);
> -	sdrv->remove(to_spmi_device(dev));
> +	if (sdrv->remove)
> +		sdrv->remove(to_spmi_device(dev));
>  	pm_runtime_put_noidle(dev);
>  
>  	pm_runtime_disable(dev);

What in-kernel spmi driver does not have a remove function set that
requires this change?

thanks,

greg k-h

  reply	other threads:[~2022-12-13 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04  9:22 [PATCH] Update spmi driver removal API Jishnu Prakash
2022-12-04  9:23 ` [PATCH] spmi: Add check for remove callback in spmi_drv_remove API Jishnu Prakash
2022-12-13 12:04   ` Greg KH [this message]
2022-12-13 13:42     ` Jishnu Prakash
2022-12-13 15:09       ` Greg KH
2022-12-21  5:39         ` Jishnu Prakash

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=Y5hqMFw0xl6lmJYL@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm-owner@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_collinsd@quicinc.com \
    --cc=quic_jestar@quicinc.com \
    --cc=quic_jprakash@quicinc.com \
    --cc=quic_kamalw@quicinc.com \
    --cc=quic_subbaram@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).