Prev: percpu: add __percpu sparse annotations to hw_breakpoint
Next: [PATCH] regulator: trivial: fix typos in user-visible Kconfig text
From: Américo Wang on 25 Jan 2010 22:10 On Tue, Jan 26, 2010 at 5:41 AM, Himanshu Chauhan <hschauhan(a)nulltrace.org> wrote: > Hi all, > > This is a small patch that fixes the build warning > of scripts/kallsyms.c > > Regards > Himanshu > > Signed-off-by: Himanshu Chauhan <hschauhan(a)nulltrace.org> > --- > scripts/kallsyms.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > index 86c3896..e3902fb 100644 > --- a/scripts/kallsyms.c > +++ b/scripts/kallsyms.c > @@ -108,8 +108,10 @@ static int read_symbol(FILE *in, struct sym_entry *s) > rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); > if (rc != 3) { > if (rc != EOF) { > - /* skip line */ > - fgets(str, 500, in); > + /* skip line. sym is used as dummy to > + * shut of "warn_unused_result" warning. > + */ > + sym = fgets(str, 500, in); > } > return -1; > } Why not use the return value to do some useful checking? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Himanshu Chauhan on 26 Jan 2010 00:30
On Tue, Jan 26, 2010 at 11:02:34AM +0800, Am�rico Wang wrote: > On Tue, Jan 26, 2010 at 5:41 AM, Himanshu Chauhan > <hschauhan(a)nulltrace.org> wrote: > > Hi all, > > > > This is a small patch that fixes the build warning > > of scripts/kallsyms.c > > > > Regards > > Himanshu > > > > Signed-off-by: Himanshu Chauhan <hschauhan(a)nulltrace.org> > > --- > > �scripts/kallsyms.c | � �6 ++++-- > > �1 files changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > > index 86c3896..e3902fb 100644 > > --- a/scripts/kallsyms.c > > +++ b/scripts/kallsyms.c > > @@ -108,8 +108,10 @@ static int read_symbol(FILE *in, struct sym_entry *s) > > � � � �rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); > > � � � �if (rc != 3) { > > � � � � � � � �if (rc != EOF) { > > - � � � � � � � � � � � /* skip line */ > > - � � � � � � � � � � � fgets(str, 500, in); > > + � � � � � � � � � � � /* skip line. sym is used as dummy to > > + � � � � � � � � � � � �* shut of "warn_unused_result" warning. > > + � � � � � � � � � � � �*/ > > + � � � � � � � � � � � sym = fgets(str, 500, in); > > � � � � � � � �} > > � � � � � � � �return -1; > > � � � �} > > Why not use the return value to do some useful checking? fgets is called as a part of error handling. Its called just to drop a line and return immediately. read_map is reading the file in a loop and read_symbol reads line by line. So I think there is no point in using return value for useful checking. Other checks like 3 items were returned or !EOF have already been done. Regards Himanshu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |