Re: [PATCH 2/2] staging: exfat: cleanup spacing for casts

From: Joe Perches
Date: Sat Sep 07 2019 - 15:24:37 EST


On Sat, 2019-09-07 at 18:58 +0000, Valentin Vidic wrote:
> Fixes checkpatch.pl warnings:
>
> CHECK: No space is necessary after a cast

Please always try to improve the code rather
than shutup checkpatch warnings.

> diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
[]
> @@ -204,7 +204,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
>
> if ((--num_alloc) == 0) {
> p_fs->clu_srch_ptr = new_clu;
> - if (p_fs->used_clusters != (u32) ~0)
> + if (p_fs->used_clusters != (u32)~0)

Probably better as UINT_MAX
etc...

> @@ -3678,7 +3678,7 @@ static int parse_options(char *options, int silent, int *debug,
> opts->fs_uid = current_uid();
> opts->fs_gid = current_gid();
> opts->fs_fmask = opts->fs_dmask = current->fs->umask;
> - opts->allow_utime = (unsigned short) -1;
> + opts->allow_utime = (unsigned short)-1;

and maybe U16_MAX

> @@ -3770,7 +3770,7 @@ static int parse_options(char *options, int silent, int *debug,
> }
>
> out:
> - if (opts->allow_utime == (unsigned short) -1)
> + if (opts->allow_utime == (unsigned short)-1)
> opts->allow_utime = ~opts->fs_dmask & 0022;
>
> return 0;