mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/kallsyms build warning fix
@ 2010-01-25 21:41 Himanshu Chauhan
  2010-01-26  3:02 ` Américo Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Himanshu Chauhan @ 2010-01-25 21:41 UTC (permalink / raw)
  To: Linux Kernel; +Cc: greg, Himanshu Chauhan

Hi all,

This is a small patch that fixes the build warning
of scripts/kallsyms.c

Regards
Himanshu

Signed-off-by: Himanshu Chauhan <hschauhan@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;
 	}
-- 
1.6.3.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/kallsyms build warning fix
  2010-01-25 21:41 [PATCH] scripts/kallsyms build warning fix Himanshu Chauhan
@ 2010-01-26  3:02 ` Américo Wang
  2010-01-26  5:13   ` Himanshu Chauhan
  0 siblings, 1 reply; 3+ messages in thread
From: Américo Wang @ 2010-01-26  3:02 UTC (permalink / raw)
  To: Himanshu Chauhan; +Cc: Linux Kernel, greg

On Tue, Jan 26, 2010 at 5:41 AM, Himanshu Chauhan
<hschauhan@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@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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/kallsyms build warning fix
  2010-01-26  3:02 ` Américo Wang
@ 2010-01-26  5:13   ` Himanshu Chauhan
  0 siblings, 0 replies; 3+ messages in thread
From: Himanshu Chauhan @ 2010-01-26  5:13 UTC (permalink / raw)
  To: Américo Wang; +Cc: Linux Kernel, greg

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@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@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-26  5:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-25 21:41 [PATCH] scripts/kallsyms build warning fix Himanshu Chauhan
2010-01-26  3:02 ` Américo Wang
2010-01-26  5:13   ` Himanshu Chauhan

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®