Re: [patch 02/20] chardev: GPIO for SCx200: modernize char-dev initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13/06/06, Jim Cromie <jim.cromie@xxxxxxxxx> wrote:
Jesper Juhl wrote:

Thanks Jesper!
> On 12/06/06, Jim Cromie <jim.cromie@xxxxxxxxx> wrote:
>>
>> Update the char-dev initialization code to use modern 2.6 API, ala LDD3.
>>
> [snip]
>> +extern void scx200_gpio_dump(unsigned index);
>> +
>>  static ssize_t scx200_gpio_write(struct file *file, const char
>> __user * data,
>>                                  size_t len, loff_t * ppos)
>
> Kernel coding style is "loff_t *ppos", not "loff_t * ppos" - I can see
> why you are not making that change here as it would be unrelated, but
> perhaps you could clean stuff like that up as well - either in your
> first "spring clean" patch
Ironically, it was scripts/Lindent that did that * ppos damage. :-/
I figured it was intended.


While scripts/Lindent is a good tool for beating messy code roughly
into shape it's not perfect and the changes it makes need to be
reviewed and hand modified.



>> +               return rc;
>
> Here you return directly ...
>
[snip]
>> +               rc = -ENOMEM;
>> +               goto fail_malloc;
>
> But here you use a label at the end of the function.
> Make up your mind, do you want the function to be 'single exit' or
> 'multiple exit'?  I'd suggest trying to be consistent (and single exit
> is often nice).
>
IIRC, I returned cuz there was no undoing to do.
But I see your point,  and will regularize (with gotos).

There's no "this is always right" and "this is always wrong", it's
always a judgement call, but generally, having single exit makes it
easier to validate a function - but in some cases it doesn't make
sense... I just pointed it out because it caught my eye, you deside
what to do :)


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux