summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2018-07-25 13:36:23 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2018-07-25 13:36:23 +0200
commit4b4cb5e4b5fbe9612ec7b3d28dc840ed55d77019 (patch)
tree9c3aff082108f60ca2b31d25aea20ca0e2089d18
parentd97ab0c87fd674ec697b8c349198e3d16e3e338d (diff)
thermal/drivers/hisi: Fix allocation for sensors
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--drivers/thermal/hisi_thermal.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 78bac1c80f21..07f421f0e783 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -61,6 +61,8 @@
#define HI3660_LITTLE_SENSOR 0
#define HI3660_BIG_SENSOR 1
+#define DEBUG 1
+
struct hisi_thermal_data;
struct hisi_thermal_sensor {
@@ -422,16 +424,18 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
struct platform_device *pdev = data->pdev;
struct device *dev = &pdev->dev;
- data->sensor = devm_kzalloc(dev, sizeof(*data->sensor), GFP_KERNEL);
+ data->nr_sensors = 2;
+
+ data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) *
+ data->nr_sensors, GFP_KERNEL);
if (!data->sensor)
return -ENOMEM;
- data->sensor[0].id = HI3660_BIG_SENSOR;
+ data->sensor[0].id = HI3660_LITTLE_SENSOR;
data->sensor[0].data = data;
- data->sensor[1].id = HI3660_LITTLE_SENSOR;
+ data->sensor[1].id = HI3660_BIG_SENSOR;
data->sensor[1].data = data;
- data->nr_sensors = 2;
return 0;
}
@@ -443,8 +447,8 @@ static int hisi_thermal_get_temp(void *__data, int *temp)
*temp = data->ops->get_temp(sensor);
- dev_dbg(&data->pdev->dev, "id=%d, temp=%d, thres=%d\n",
- sensor->id, *temp, sensor->thres_temp);
+ dev_dbg(&data->pdev->dev, "tzd=%p, id=%d, temp=%d, thres=%d\n",
+ sensor->tzd, sensor->id, *temp, sensor->thres_temp);
return 0;
}