lkml.org 
[lkml]   [2018]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] tools/gup_benchmark: Allow user specified file
On Wed, Oct 10, 2018 at 03:31:01PM -0700, Andrew Morton wrote:
> On Wed, 10 Oct 2018 13:56:03 -0600 Keith Busch <keith.busch@intel.com> wrote:
> > + filed = open(file, O_RDWR|O_CREAT);
> > + if (filed < 0)
> > + perror("open"), exit(filed);
>
> Ick. Like this, please:

Yeah, I agree. I just copied the style this file had been using in other
error cases, but I still find it less readable than your recommendation.

> --- a/tools/testing/selftests/vm/gup_benchmark.c~tools-gup_benchmark-allow-user-specified-file-fix
> +++ a/tools/testing/selftests/vm/gup_benchmark.c
> @@ -71,8 +71,10 @@ int main(int argc, char **argv)
> }
>
> filed = open(file, O_RDWR|O_CREAT);
> - if (filed < 0)
> - perror("open"), exit(filed);
> + if (filed < 0) {
> + perror("open");
> + exit(filed);
> + }
>
> gup.nr_pages_per_call = nr_pages;
> gup.flags = write;
>

\
 
 \ /
  Last update: 2018-10-11 00:47    [W:0.038 / U:2.860 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site