public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Prarit Bhargava <prarit@redhat.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/7] intel-speed-select: Add check for CascadeLake-N models
Date: Mon, 7 Oct 2019 13:03:13 +0300	[thread overview]
Message-ID: <20191007100313.GP32742@smile.fi.intel.com> (raw)
In-Reply-To: <b1895913e2adaff4daf7be6b919e50714b418fe8.camel@linux.intel.com>

On Fri, Oct 04, 2019 at 10:15:21AM -0700, Srinivas Pandruvada wrote:
> On Thu, 2019-10-03 at 08:11 -0400, Prarit Bhargava wrote:

> > +	/* only three CascadeLake-N models are supported */
> > +	if (is_clx_n_platform()) {
> > +		FILE *fp;
> > +		size_t n;
> > +		char *line;
> Need n = 0 and *line = NULL here as getline() will require if it has to
> allocate.

Good catch and thus...

> > +		int ret = 1;
> > +
> > +		fp = fopen("/proc/cpuinfo", "r");
> > +		if (!fp)
> > +			err(-1, "cannot open /proc/cpuinfo\n");
> > +
> > +		while (getline(&line, &n, fp) > 0) {

> > +			if (strstr(line, "model name")) {
> > +				if (strstr(line, "6252N") ||
> > +				    strstr(line, "6230N") ||
> > +				    strstr(line, "5218N"))
> > +					ret = 0;
> > +				break;
> > +			}

Missed free(line) here.

> > +		}
> > +		free(line);
> > +		fclose(fp);
> > +		return ret;
> > +	}
> > +	return 0;
> >  }
> >  
> >  /* Open a file, and exit on failure */
> > @@ -1889,7 +1927,9 @@ static void cmdline(int argc, char **argv)
> >  		fprintf(stderr, "Feature name and|or command not
> > specified\n");
> >  		exit(0);
> >  	}
> > -	update_cpu_model();
> > +	ret = update_cpu_model();
> > +	if (ret)
> > +		err(-1, "Invalid CPU model (%d)\n", cpu_model);
> >  	printf("Intel(R) Speed Select Technology\n");
> >  	printf("Executing on CPU model:%d[0x%x]\n", cpu_model,
> > cpu_model);
> >  	set_max_cpu_num();
> 

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2019-10-07 10:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 12:11 [PATCH v2 0/7] Add CascadeLake-N Support Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 1/7] intel-speed-select: Add int argument to command functions Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 2/7] intel-speed-select: Make process_command generic Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 3/7] intel-speed-select: Add check for CascadeLake-N models Prarit Bhargava
2019-10-04 17:15   ` Srinivas Pandruvada
2019-10-04 17:18     ` Prarit Bhargava
2019-10-07 10:03     ` Andy Shevchenko [this message]
2019-10-07 19:18       ` Srinivas Pandruvada
2019-10-03 12:11 ` [PATCH v2 4/7] intel-speed-select: Add configuration for CascadeLake-N Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 5/7] intel-speed-select: Implement CascadeLake-N help and command functions structures Prarit Bhargava
2019-10-03 12:11 ` [PATCH v2 6/7] intel-speed-select: Implement 'perf-profile info' on CascadeLake-N Prarit Bhargava
2019-10-04 17:23   ` Srinivas Pandruvada
2019-10-04 17:32     ` Srinivas Pandruvada
2019-10-04 20:14   ` Srinivas Pandruvada
2019-10-03 12:11 ` [PATCH v2 7/7] intel-speed-select: Implement base-freq commands " Prarit Bhargava

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=20191007100313.GP32742@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=srinivas.pandruvada@linux.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