Re: [PATCH v2 04/10] mfd: rz-mtu3: store &pdev->dev in local variable
From: Lee Jones
Date: Thu May 07 2026 - 08:48:00 EST
On Fri, 10 Apr 2026, Cosmin Tanislav wrote:
> &pdev->dev is accessed multiple times during probe. Store it in a local
> variable and use that to simplify the code.
>
> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>
> ---
>
> V2:
> * no changes
>
> drivers/mfd/rz-mtu3.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
This is fine.
> diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c
> index 3be6f6c900b82..37d12030e069c 100644
> --- a/drivers/mfd/rz-mtu3.c
> +++ b/drivers/mfd/rz-mtu3.c
> @@ -311,16 +311,17 @@ static const struct mfd_cell rz_mtu3_devs[] = {
>
> static int rz_mtu3_probe(struct platform_device *pdev)
> {
> + struct device *dev = &pdev->dev;
> struct reset_control *rstc;
> struct rz_mtu3_priv *priv;
> struct rz_mtu3 *ddata;
> unsigned int i;
>
> - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
> + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
> if (!ddata)
> return -ENOMEM;
>
> - ddata->priv_data = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + ddata->priv_data = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!ddata->priv_data)
> return -ENOMEM;
>
> @@ -330,11 +331,11 @@ static int rz_mtu3_probe(struct platform_device *pdev)
> if (IS_ERR(priv->mmio))
> return PTR_ERR(priv->mmio);
>
> - rstc = devm_reset_control_get_exclusive_deasserted(&pdev->dev, NULL);
> + rstc = devm_reset_control_get_exclusive_deasserted(dev, NULL);
> if (IS_ERR(rstc))
> return PTR_ERR(rstc);
>
> - ddata->clk = devm_clk_get(&pdev->dev, NULL);
> + ddata->clk = devm_clk_get(dev, NULL);
> if (IS_ERR(ddata->clk))
> return PTR_ERR(ddata->clk);
>
> @@ -347,7 +348,7 @@ static int rz_mtu3_probe(struct platform_device *pdev)
> mutex_init(&ddata->channels[i].lock);
> }
>
> - return devm_mfd_add_devices(&pdev->dev, 0, rz_mtu3_devs,
> + return devm_mfd_add_devices(dev, 0, rz_mtu3_devs,
> ARRAY_SIZE(rz_mtu3_devs), NULL, 0, NULL);
> }
>
> --
> 2.53.0
--
Lee Jones