Re: [PATCH] staging: exfat: cleanup explicit comparisons to NULL

2019-09-03 Thread Greg Kroah-Hartman
On Tue, Sep 03, 2019 at 07:13:37PM +0200, Valentin Vidic wrote:
> Fixes checkpatch.pl warnings:
> 
>   CHECK: Comparison to NULL could be written "expr"
>   CHECK: Comparison to NULL could be written "!expr"
> 
> Signed-off-by: Valentin Vidic 
> ---
>  drivers/staging/exfat/exfat_core.c  | 34 -
>  drivers/staging/exfat/exfat_super.c | 58 ++---
>  2 files changed, 46 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/staging/exfat/exfat_core.c 
> b/drivers/staging/exfat/exfat_core.c
> index 46b9f4455da1..7b39544cdaf1 100644
> --- a/drivers/staging/exfat/exfat_core.c
> +++ b/drivers/staging/exfat/exfat_core.c
> @@ -100,7 +100,7 @@ void fs_set_vol_flags(struct super_block *sb, u32 
> new_flag)
>   p_fs->vol_flag = new_flag;
>  
>   if (p_fs->vol_type == EXFAT) {
> - if (p_fs->pbr_bh == NULL) {
> + if (!p_fs->pbr_bh) {
>   if (sector_read(sb, p_fs->PBR_sector,
>   _fs->pbr_bh, 1) != FFS_SUCCESS)
>   return;
> @@ -543,7 +543,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
>   p_fs->vol_amap = 
> kmalloc_array(p_fs->map_sectors,
>  sizeof(struct 
> buffer_head *),
>  GFP_KERNEL);
> - if (p_fs->vol_amap == NULL)
> + if (!p_fs->vol_amap)
>   return FFS_MEMORYERR;
>  
>   sector = START_SECTOR(p_fs->map_clu);
> @@ -685,7 +685,7 @@ void sync_alloc_bitmap(struct super_block *sb)
>   int i;
>   struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
>  
> - if (p_fs->vol_amap == NULL)
> + if (!p_fs->vol_amap)
>   return;
>  
>   for (i = 0; i < p_fs->map_sectors; i++)
> @@ -714,7 +714,7 @@ static s32 __load_upcase_table(struct super_block *sb, 
> sector_t sector,
>  
>   upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
>   GFP_KERNEL);
> - if (upcase_table == NULL)
> + if (!upcase_table)
>   return FFS_MEMORYERR;
>   memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
>  
> @@ -750,11 +750,11 @@ static s32 __load_upcase_table(struct super_block *sb, 
> sector_t sector,
>   else { /* uni != index , uni != 0x */
>   u16 col_index = get_col_index(index);
>  
> - if (upcase_table[col_index] == NULL) {
> + if (!upcase_table[col_index]) {
>   pr_debug("alloc = 0x%X\n", col_index);
>   upcase_table[col_index] = 
> kmalloc_array(UTBL_ROW_COUNT,
>   sizeof(u16), GFP_KERNEL);
> - if (upcase_table[col_index] == NULL) {
> + if (!upcase_table[col_index]) {
>   ret = FFS_MEMORYERR;
>   goto error;
>   }
> @@ -794,7 +794,7 @@ static s32 __load_default_upcase_table(struct super_block 
> *sb)
>  
>   upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
>   GFP_KERNEL);
> - if (upcase_table == NULL)
> + if (!upcase_table)
>   return FFS_MEMORYERR;
>   memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
>  
> @@ -812,12 +812,12 @@ static s32 __load_default_upcase_table(struct 
> super_block *sb)
>   else { /* uni != index , uni != 0x */
>   u16 col_index = get_col_index(index);
>  
> - if (upcase_table[col_index] == NULL) {
> + if (!upcase_table[col_index]) {
>   pr_debug("alloc = 0x%X\n", col_index);
>   upcase_table[col_index] = 
> kmalloc_array(UTBL_ROW_COUNT,
>   
> sizeof(u16),
>   
> GFP_KERNEL);
> - if (upcase_table[col_index] == NULL) {
> + if (!upcase_table[col_index]) {
>   ret = FFS_MEMORYERR;
>   goto error;
>   }
> @@ -1640,7 +1640,7 @@ struct dentry_t *get_entry_with_sector(struct 
> super_block *sb, sector_t sector,
>  
>   buf = buf_getblk(sb, sector);
>  
> - if (buf == NULL)
> + if (!buf)
>   return NULL;
>  
>   return (struct dentry_t *)(buf + offset);
> @@ -1658,10 +1658,10 @@ struct dentry_t *get_entry_in_dir(struct 

[PATCH] staging: exfat: cleanup explicit comparisons to NULL

2019-09-03 Thread Valentin Vidic
Fixes checkpatch.pl warnings:

  CHECK: Comparison to NULL could be written "expr"
  CHECK: Comparison to NULL could be written "!expr"

Signed-off-by: Valentin Vidic 
---
 drivers/staging/exfat/exfat_core.c  | 34 -
 drivers/staging/exfat/exfat_super.c | 58 ++---
 2 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/exfat/exfat_core.c 
b/drivers/staging/exfat/exfat_core.c
index 46b9f4455da1..7b39544cdaf1 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -100,7 +100,7 @@ void fs_set_vol_flags(struct super_block *sb, u32 new_flag)
p_fs->vol_flag = new_flag;
 
if (p_fs->vol_type == EXFAT) {
-   if (p_fs->pbr_bh == NULL) {
+   if (!p_fs->pbr_bh) {
if (sector_read(sb, p_fs->PBR_sector,
_fs->pbr_bh, 1) != FFS_SUCCESS)
return;
@@ -543,7 +543,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
p_fs->vol_amap = 
kmalloc_array(p_fs->map_sectors,
   sizeof(struct 
buffer_head *),
   GFP_KERNEL);
-   if (p_fs->vol_amap == NULL)
+   if (!p_fs->vol_amap)
return FFS_MEMORYERR;
 
sector = START_SECTOR(p_fs->map_clu);
@@ -685,7 +685,7 @@ void sync_alloc_bitmap(struct super_block *sb)
int i;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
 
-   if (p_fs->vol_amap == NULL)
+   if (!p_fs->vol_amap)
return;
 
for (i = 0; i < p_fs->map_sectors; i++)
@@ -714,7 +714,7 @@ static s32 __load_upcase_table(struct super_block *sb, 
sector_t sector,
 
upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
GFP_KERNEL);
-   if (upcase_table == NULL)
+   if (!upcase_table)
return FFS_MEMORYERR;
memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
 
@@ -750,11 +750,11 @@ static s32 __load_upcase_table(struct super_block *sb, 
sector_t sector,
else { /* uni != index , uni != 0x */
u16 col_index = get_col_index(index);
 
-   if (upcase_table[col_index] == NULL) {
+   if (!upcase_table[col_index]) {
pr_debug("alloc = 0x%X\n", col_index);
upcase_table[col_index] = 
kmalloc_array(UTBL_ROW_COUNT,
sizeof(u16), GFP_KERNEL);
-   if (upcase_table[col_index] == NULL) {
+   if (!upcase_table[col_index]) {
ret = FFS_MEMORYERR;
goto error;
}
@@ -794,7 +794,7 @@ static s32 __load_default_upcase_table(struct super_block 
*sb)
 
upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
GFP_KERNEL);
-   if (upcase_table == NULL)
+   if (!upcase_table)
return FFS_MEMORYERR;
memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
 
@@ -812,12 +812,12 @@ static s32 __load_default_upcase_table(struct super_block 
*sb)
else { /* uni != index , uni != 0x */
u16 col_index = get_col_index(index);
 
-   if (upcase_table[col_index] == NULL) {
+   if (!upcase_table[col_index]) {
pr_debug("alloc = 0x%X\n", col_index);
upcase_table[col_index] = 
kmalloc_array(UTBL_ROW_COUNT,

sizeof(u16),

GFP_KERNEL);
-   if (upcase_table[col_index] == NULL) {
+   if (!upcase_table[col_index]) {
ret = FFS_MEMORYERR;
goto error;
}
@@ -1640,7 +1640,7 @@ struct dentry_t *get_entry_with_sector(struct super_block 
*sb, sector_t sector,
 
buf = buf_getblk(sb, sector);
 
-   if (buf == NULL)
+   if (!buf)
return NULL;
 
return (struct dentry_t *)(buf + offset);
@@ -1658,10 +1658,10 @@ struct dentry_t *get_entry_in_dir(struct super_block 
*sb, struct chain_t *p_dir,
 
buf = buf_getblk(sb, sec);
 
-   if (buf == NULL)
+   if (!buf)
return NULL;
 
-   if