All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChiYuan Huang <cy_huang@richtek.com>
To: <broonie@kernel.org>
Cc: <tony@atomide.com>, <lgirdwood@gmail.com>, <jneanne@baylibre.com>,
	<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] regulator: tps65219: Fix pointer assignment in tps65219_get_rdev_by_name()
Date: Fri, 16 Jun 2023 12:22:17 +0800	[thread overview]
Message-ID: <20230616042217.GA3996@linuxcarl2.richtek.com> (raw)
In-Reply-To: <1686884364-31447-1-git-send-email-cy_huang@richtek.com>

On Fri, Jun 16, 2023 at 10:59:24AM +0800, cy_huang@richtek.com wrote:
> From: ChiYuan Huang <cy_huang@richtek.com>
> 
> For the pointer assignment in function body, double pointer must be used as
> the input parameter.
> 
> Fixes: c12ac5fc3e0a ("regulator: drivers: Add TI TPS65219 PMIC regulators support")
> Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>

Please ignore it. Krzysztof's patch already fix it and applied.
https://lore.kernel.org/lkml/20230507144656.192800-1-krzysztof.kozlowski@linaro.org/
> ---
> Hi,
> 
> I try to fix W=1 build warning for tps65219-regulator.
> 
> W=1
>     warning: parameter ‘dev’ set but not used [-Wunused-but-set-parameter]
>     struct regulator_dev *dev)
>                          ^~~~~
> But the issue is not what the warning message described.
> 
> In tps65219_get_rdev_by_name(), it must return the found rdev and assign it
> in 'dev' pointer. Due to pointer assignment issue, it doesn't.
> 
> The original code may not cause any problem. But it always takes the last
> registered regulator rdev for all tps65219 regulator interrupts.
> ---
>  drivers/regulator/tps65219-regulator.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
> index b1719ee990ab..8971b507a79a 100644
> --- a/drivers/regulator/tps65219-regulator.c
> +++ b/drivers/regulator/tps65219-regulator.c
> @@ -289,13 +289,13 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
>  
>  static int tps65219_get_rdev_by_name(const char *regulator_name,
>  				     struct regulator_dev *rdevtbl[7],
> -				     struct regulator_dev *dev)
> +				     struct regulator_dev **dev)
>  {
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
>  		if (strcmp(regulator_name, regulators[i].name) == 0) {
> -			dev = rdevtbl[i];
> +			*dev = rdevtbl[i];
>  			return 0;
>  		}
>  	}
> @@ -348,7 +348,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
>  		irq_data[i].dev = tps->dev;
>  		irq_data[i].type = irq_type;
>  
> -		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
> +		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, &rdev);
>  		if (IS_ERR(rdev)) {
>  			dev_err(tps->dev, "Failed to get rdev for %s\n",
>  				irq_type->regulator_name);
> -- 
> 2.40.1
> 

      reply	other threads:[~2023-06-16  4:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  2:59 [PATCH] regulator: tps65219: Fix pointer assignment in tps65219_get_rdev_by_name() cy_huang
2023-06-16  4:22 ` ChiYuan Huang [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=20230616042217.GA3996@linuxcarl2.richtek.com \
    --to=cy_huang@richtek.com \
    --cc=broonie@kernel.org \
    --cc=jneanne@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.