Re: [PATCH][FAT] FAT dirent scan with hin take #2
From: Pekka Enberg
Date: Tue Aug 30 2005 - 03:52:18 EST
Hi,
Some coding style nitpicks.
On 8/30/05, Machida, Hiroyuki <machida@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/