[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50928BC9.30305@gmail.com>
Date: Thu, 01 Nov 2012 15:48:41 +0100
From: Francesco Lavra <francescolavra.fl@...il.com>
To: "hongbo.zhang" <hongbo.zhang@...aro.org>
CC: linaro-dev@...ts.linaro.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, rui.zhang@...el.com,
amit.kachhap@...aro.org, STEricsson_nomadik_linux@...t.st.com,
kernel@...oocommunity.org, linaro-kernel@...ts.linaro.org,
"hongbo.zhang" <hongbo.zhang@...aro.com>, patches@...aro.org
Subject: Re: [PATCH V3 4/5] Thermal: Add ST-Ericsson DB8500 thermal driver.
Hi,
On 10/30/2012 05:49 PM, hongbo.zhang wrote:
> From: "hongbo.zhang" <hongbo.zhang@...aro.com>
>
> This diver is based on the thermal management framework in thermal_sys.c. A
> thermal zone device is created with the trip points to which cooling devices
> can be bound, the current cooling device is cpufreq, e.g. CPU frequency is
> clipped down to cool the CPU, and other cooling devices can be added and bound
> to the trip points dynamically. The platform specific PRCMU interrupts are
> used to active thermal update when trip points are reached.
>
> Signed-off-by: hongbo.zhang <hongbo.zhang@...aro.com>
[...]
> +static struct db8500_thsens_platform_data*
> + db8500_thermal_parse_dt(struct platform_device *pdev)
> +{
> + struct db8500_thsens_platform_data *ptrips;
> + struct device_node *np = pdev->dev.of_node;
> + char prop_name[32];
> + const char *tmp_str;
> + u32 tmp_data;
> + int i, j;
> +
> + ptrips = devm_kzalloc(&pdev->dev, sizeof(*ptrips), GFP_KERNEL);
> + if (!ptrips)
> + return NULL;
> +
> + if (of_property_read_u32(np, "num-trips", &tmp_data))
> + goto err_parse_dt;
> +
> + if (tmp_data > THERMAL_MAX_TRIPS)
> + goto err_parse_dt;
> +
> + ptrips->num_trips = tmp_data;
> +
> + for (i = 0; i < ptrips->num_trips; i++) {
> + sprintf(prop_name, "trip%d-temp", i);
> + if (of_property_read_u32(np, prop_name, &tmp_data))
> + goto err_parse_dt;
> +
> + ptrips->trip_points[i].temp = tmp_data;
> +
> + sprintf(prop_name, "trip%d-type", i);
> + if (of_property_read_string(np, prop_name, &tmp_str))
> + goto err_parse_dt;
> +
> + if (!strcmp(tmp_str, "active"))
> + ptrips->trip_points[i].type = THERMAL_TRIP_ACTIVE;
> + else if (!strcmp(tmp_str, "passive"))
> + ptrips->trip_points[i].type = THERMAL_TRIP_PASSIVE;
> + else if (!strcmp(tmp_str, "hot"))
> + ptrips->trip_points[i].type = THERMAL_TRIP_HOT;
> + else if (!strcmp(tmp_str, "critical"))
> + ptrips->trip_points[i].type = THERMAL_TRIP_CRITICAL;
> + else
> + goto err_parse_dt;
> +
> + sprintf(prop_name, "trip%d-cdev-num", i);
> + if (of_property_read_u32(np, prop_name, &tmp_data))
> + goto err_parse_dt;
> +
> + if (tmp_data > COOLING_DEV_MAX)
> + goto err_parse_dt;
> +
> + for (j = 0; j < tmp_data; j++) {
> + sprintf(prop_name, "trip%d-cdev-name%d", i, j);
> + if (of_property_read_string(np, prop_name, &tmp_str))
> + goto err_parse_dt;
> +
> + if (strlen(tmp_str) > THERMAL_NAME_LENGTH)
> + goto err_parse_dt;
> +
> + strcpy(ptrips->trip_points[i].cdev_name[j], tmp_str);
If strlen(tmp_str) equals THERMAL_NAME_LENGTH, strcpy() will go past the
size of the destination array.
After the above is fixed, you can add my:
Reviewed-by: Francesco Lavra <francescolavra.fl@...il.com>
If you re-send a new version of the patch series, I suggest you do so in
a new thread.
Thanks,
Francesco
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists