Hi,
Some coding style nitpicks.
On 8/30/05, Machida, Hiroyuki <[email protected]> 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|