]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mfd: rz-mtu3: Store &pdev->dev in local variable
authorCosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Wed, 27 May 2026 14:56:05 +0000 (17:56 +0300)
committerLee Jones <lee@kernel.org>
Wed, 17 Jun 2026 10:33:05 +0000 (11:33 +0100)
&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@renesas.com>
Link: https://patch.msgid.link/20260527145606.136536-4-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/rz-mtu3.c

index 8122355e0e2969096bf596318bca63eea9d71e55..f64c748d6ce4f0188d9cf8505fa1c942d14c448b 100644 (file)
@@ -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 rz_mtu3_priv *priv;
        struct rz_mtu3 *ddata;
        struct reset_control *rstc;
        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);
 }