From: Eduardo Valentin <eduardo.valentin@ti.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <eduardo.valentin@ti.com>,
linux-pm@vger.kernel.org
Subject: Re: [PATCHv2] thermal: cut the spaces when user sets policy
Date: Wed, 8 May 2013 11:31:38 -0400 [thread overview]
Message-ID: <518A6FDA.6040006@ti.com> (raw)
In-Reply-To: <1367936460-15257-1-git-send-email-andriy.shevchenko@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]
Andy,
On 07-05-2013 10:21, Andy Shevchenko wrote:
> Setting policy results in invalid value error.
> % echo "step_wise" > policy
> % echo: write error: Invalid argument
>
> Need clean up of the buffer which "echo" may add based on the arguments, before
> comparing aganist list of governor names.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
This one was close..
> ---
> In v2:
> - copy input string to a temporary buffer
> drivers/thermal/thermal_core.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d755440..e256380 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -33,6 +33,7 @@
> #include <linux/idr.h>
> #include <linux/thermal.h>
> #include <linux/reboot.h>
> +#include <linux/string.h>
> #include <net/netlink.h>
> #include <net/genetlink.h>
>
> @@ -713,10 +714,13 @@ policy_store(struct device *dev, struct device_attribute *attr,
> int ret = -EINVAL;
> struct thermal_zone_device *tz = to_thermal_zone(dev);
> struct thermal_governor *gov;
> + char *name[THERMAL_NAME_LENGTH];
I really believe you meant:
+ char name[THERMAL_NAME_LENGTH];
> +
> + snprintf(name, sizeof(name), "%s", buf);
>
Still there are compilation warnings.
> mutex_lock(&thermal_governor_lock);
>
> - gov = __find_governor(buf);
> + gov = __find_governor(strim(name));
> if (!gov)
> goto exit;
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]
prev parent reply other threads:[~2013-05-08 15:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 14:21 [PATCHv2] thermal: cut the spaces when user sets policy Andy Shevchenko
2013-05-08 15:31 ` Eduardo Valentin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=518A6FDA.6040006@ti.com \
--to=eduardo.valentin@ti.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox