lkml.org 
[lkml]   [2005]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][FAT] FAT dirent scan with hin take #2
Hi,

Some coding style nitpicks.

On 8/30/05, Machida, Hiroyuki <machida@sm.sony.co.jp> wrote:
> +inline
> +static int hint_allocate(struct inode *dir)
> +{
> + void *hints;
> + int err = 0;
> +
> + if (!MSDOS_I(dir)->scan_hints) {
> + hints = kmalloc(FAT_SCAN_NWAY*sizeof(loff_t),GFP_KERNEL);
> + if (hints)
> + memset(hints, 0, FAT_SCAN_NWAY*sizeof(loff_t));
> + else
> + err = -ENOMEM;

Please consider using kcalloc().

> +
> + down(&MSDOS_I(dir)->scan_lock);
> + if (MSDOS_I(dir)->scan_hints) err = -EINVAL;

Please put the statement after if clause to a separate line. The above
makes code very hard to read.

> + if (!err) MSDOS_I(dir)->scan_hints = hints;
> + up(&MSDOS_I(dir)->scan_lock);
> + if (err == -EINVAL) {
> + if (hints) kfree(hints);

kfree() can handle NULLs just fine so please drop the redundant check.

Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-30 10:54    [W:0.082 / U:1.188 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site