Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[platform/kernel/linux-starfive.git] / drivers / thermal / qcom / tsens.c
index 20f3b87..3440166 100644 (file)
@@ -112,7 +112,6 @@ static int tsens_probe(struct platform_device *pdev)
        int ret, i;
        struct device *dev;
        struct device_node *np;
-       struct tsens_sensor *s;
        struct tsens_device *tmdev;
        const struct tsens_data *data;
        const struct of_device_id *id;
@@ -141,8 +140,9 @@ static int tsens_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
-                            num_sensors * sizeof(*s), GFP_KERNEL);
+       tmdev = devm_kzalloc(dev,
+                            struct_size(tmdev, sensor, num_sensors),
+                            GFP_KERNEL);
        if (!tmdev)
                return -ENOMEM;