lkml.org 
[lkml]   [2008]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] This patch to profile.c fixes a few errors reported by checkpatch.pl
    On Jan 4, 2008 2:07 PM, Ingo Molnar <mingo@elte.hu> wrote:
    [...]
    > > That said, the errors reported by checkpatch.pl are now:
    > > paolo@paolo-desktop:~/linux-2.6/kernel$ ../scripts/checkpatch.pl
    > > --terse --file profile.c |grep ERROR
    > > profile.c:128: ERROR: "foo * bar" should be "foo *bar"
    > > I just forgot to fix it, very trivial. Will do in a minute.
    > >
    > > profile.c:460: ERROR: do not use assignment in if condition (+ if
    > > (!(entry = create_proc_entry("XXXXXXXXXXXXX", 0600, root_irq_dir))))
    > > profile.c:594: ERROR: do not use assignment in if condition (+ if
    > > (!(entry = create_proc_entry("XXXXXXX", S_IWUSR | S_IRUGO, NULL))))
    > > Here I need an hint ( or an example) about how to fix these two errors :-)
    >
    > transform:
    >
    > if (!(x = y))
    >
    > to:
    >
    > x = y
    > if (!x)
    >
    > i.e. take the implicit assignment out of the condition. (it's easy to
    > mistake it for '==' while reviewing the code and forgetting about the
    > assignment's side-effect)

    OK, thanks.

    Is the following correct?

    Before:
    if (!(entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir)))

    After:
    entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir)
    if (!entry)

    BTW, how can i compile only the profile.c file?
    I would like to verify that my changes (now I'm at total: 2 errors, 1
    warnings, 599 lines checked)
    doesn't impact on the compiled code?

    Thanks.

    Ciao,
    --
    Paolo
    http://paolo.ciarrocchi.googlepages.com/


    \
     
     \ /
      Last update: 2008-01-04 14:21    [W:0.037 / U:0.244 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site