mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Sujith Thomas <sujith.thomas@intel.com>,
	Zhang Rui <rui.zhang@intel.com>
Cc: roel kluin <roel.kluin@gmail.com>,
	len.brown@intel.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH] intel_menlo: max_state is unsigned, invalid test
Date: Mon, 03 Nov 2008 23:07:08 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0811032300551.3132@localhost.localdomain> (raw)
In-Reply-To: <20081103143526.375be238.akpm@linux-foundation.org>



On Mon, 3 Nov 2008, Andrew Morton wrote:

> On Wed, 29 Oct 2008 17:06:47 -0400
> roel kluin <roel.kluin@gmail.com> wrote:
> 
> > max_state is unsigned, so the test is invalid.
> > 
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> > ---
> > I think max_state can only become -1, no? then probably a different
> > patch is required.
> > I may not be able to respond for a few weeks.
> > 
> > diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
> > index e00a275..980171d 100644
> > --- a/drivers/misc/intel_menlow.c
> > +++ b/drivers/misc/intel_menlow.c
> > @@ -121,7 +121,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
> >  	if (memory_get_int_max_bandwidth(cdev, &max_state))
> >  		return -EFAULT;
> >  
> > -	if (max_state < 0 || state > max_state)
> > +	if (max_state == -1 || state > max_state)
> >  		return -EINVAL;
> >  
> >  	arg_list.count = 1;
> > 
> 
> hm, maybe.
> 
> This can only happen if acpi_evaluate_integer(MEMORY_GET_BANDWIDTH)
> returned no-error and a bandwidth of zero (I assume).
> 
> Is this a special case which the driver really wanted to handle?  If
> so, why is "0" the only bad value which we're checking for?  Or is this
> all some big brainfart which should be removed?

Sujith,
Please send me a patch to intel_menlo.c that documents the
legal return values from GTHS.

If 0 is illegal, that is fine, but the upstream driver doesn't
check for it properl (I like Rui's 9/11 patch better than the above,
so andrew, you can drop this patch in any case)

thanks,
-Len

ps.  Sujith, shouldn't there be a MAINTAINERS for this driver with your 
name on it?




  reply	other threads:[~2008-11-04  4:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 21:06 roel kluin
2008-11-03 22:35 ` Andrew Morton
2008-11-04  4:07   ` Len Brown [this message]
2008-11-05 10:20     ` Thomas, Sujith

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=alpine.LFD.2.00.0811032300551.3132@localhost.localdomain \
    --to=lenb@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    --cc=rui.zhang@intel.com \
    --cc=sujith.thomas@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

all inboxes | Powered by JetHome®