LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Mark Brown <broonie@kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode
Date: Tue, 14 Apr 2015 21:11:58 +0900	[thread overview]
Message-ID: <CAC5umyisp-aWU1mGajCCwS5yxaJvqh1UHUACEXb2ixHk5_+fJA@mail.gmail.com> (raw)
In-Reply-To: <1423712131-23795-3-git-send-email-bjorn.andersson@sonymobile.com>

2015-02-12 12:35 GMT+09:00 Bjorn Andersson <bjorn.andersson@sonymobile.com>:
> The function regulator_set_optimum_mode() is changing name to
> regulator_set_load(), so update the code accordingly. Also cleaned up
> ufshcd_config_vreg_load() while touching the code.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 2e4614b..4b73b94 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4225,22 +4225,15 @@ static struct scsi_host_template ufshcd_driver_template = {
>  static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
>                                    int ua)
>  {
> -       int ret = 0;
> -       struct regulator *reg = vreg->reg;
> -       const char *name = vreg->name;
> +       int ret;
>
> -       BUG_ON(!vreg);
> +       if (!vreg)
> +               return 0;
>
> -       ret = regulator_set_optimum_mode(reg, ua);
> -       if (ret >= 0) {
> -               /*
> -                * regulator_set_optimum_mode() returns new regulator
> -                * mode upon success.
> -                */
> -               ret = 0;
> -       } else {
> -               dev_err(dev, "%s: %s set optimum mode(ua=%d) failed, err=%d\n",
> -                               __func__, name, ua, ret);
> +       ret = regulator_set_load(vreg->reg, ua);
> +       if (ret < 0) {
> +               dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n",
> +                               __func__, vreg->name, ua, ret);
>         }
>
>         return ret;
> @@ -4249,18 +4242,12 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
>  static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba,
>                                          struct ufs_vreg *vreg)
>  {
> -       if (!vreg)
> -               return 0;
> -
>         return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA);
>  }
>
>  static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
>                                          struct ufs_vreg *vreg)
>  {
> -       if (!vreg)
> -               return 0;
> -
>         return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA);
>  }

I tried this patch and it caused kernel null pointer dereference with
'verg->max_uA' when vreg == NULL.  So you can't simply move !vreg check here
into ufshcd_config_vreg_load().

  reply	other threads:[~2015-04-14 12:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
2015-02-12  3:35 ` [PATCH 1/5] regulator: " Bjorn Andersson
2015-02-12  3:35 ` [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode Bjorn Andersson
2015-04-14 12:11   ` Akinobu Mita [this message]
2015-04-15 18:35     ` Bjorn Andersson
2015-02-12  3:35 ` [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode Bjorn Andersson
2015-02-27 15:29   ` Felipe Balbi
2015-02-12  3:35 ` [PATCH 4/5] usb: phy: phy-msm-usb: " Bjorn Andersson
2015-02-27 15:30   ` Felipe Balbi
2015-02-12  3:35 ` [PATCH 5/5] regulator: Drop temporary regulator_set_optimum_mode wrapper Bjorn Andersson
2015-02-25 23:40 ` [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
2015-03-05 10:46   ` Mark Brown
2015-03-09 18:33 ` Mark Brown

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=CAC5umyisp-aWU1mGajCCwS5yxaJvqh1UHUACEXb2ixHk5_+fJA@mail.gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=vinholikatti@gmail.com \
    --subject='Re: [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode' \
    /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

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).