Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[muen/linux.git] / drivers / thermal / qcom / tsens.c
index 20f3b87d7667f7599977c7e231c5f1bf9f922496..3440166c2ae922859afb62fdf8901c1092fc8697 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;