Remove Explicit NULL Comparison
cover Remove Explicit NULL Comparison
This patchset removes null comparison by using '!' operator. Problems found using checkpatch.pl
Amitoj Kaur Chawla (2):
staging: rtl8712: Remove NULL comparison
staging: rtl8712: Remove NULL comparison
drivers/staging/rtl8712/hal_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 staging: rtl8712: Remove NULL comparison
Remove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!ptmpchar"
--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/hal_init.c +1 -1
@@ -178,7 +178,7 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) fwhdr.img_IMEM_size : fwhdr.img_SRAM_size; maxlen += txdscp_sz; ptmpchar =kmalloc (maxlen +FWBUFF_ALIGN_SZ ,GFP_ATOMIC ); -if (ptmpchar ==NULL ) +if (!ptmpchar)return ret; ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ -
Signature · 1 line
1.9.1
PATCH 2/2 staging: rtl8712: Remove NULL comparison
In reply to Amitoj Kaur ChawlaRemove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"
--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/hal_init.c +1 -1
@@ -382,7 +382,7 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)uint rtl871x_hal_init (struct _adapter *padapter) { padapter->hw_init_completed = false; -if (padapter->halpriv.hal_bus_init ==NULL ) +if (!padapter->halpriv.hal_bus_init)return _FAIL;if (padapter->halpriv.hal_bus_init (padapter) != _SUCCESS)return _FAIL;
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
Quoted 14 lines · Amitoj Kaur Chawla
Remove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rtl8712/hal_init.c +0
-0
drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 388
Quoted 8 lines
drivers/staging/rtl8712/hal_init.c +1
-1@@ -382,7 +382,7 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)uint rtl871x_hal_init (struct _adapter *padapter) { padapter->hw_init_completed = false; -if (padapter->halpriv.hal_bus_init ==NULL ) +if (!padapter->halpriv.hal_bus_init)return _FAIL;if (padapter->halpriv.hal_bus_init (padapter) != _SUCCESS)return _FAIL;
Nothing to do with the patch, but _FAIL and _SUCCESS don't look like standard kernel return values. Maybe it is possible to improve this.
julia
Quoted 10 lines
--
1.9.1--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e9962700480ca8590bb9386ab0217b449fc4b8db.1444194896.git.amitoj1606%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
Quoted 11 lines · Julia Lawall
Quoted 9 lines · Amitoj Kaur Chawla
Remove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 388
Quoted 13 lines
drivers/staging/rtl8712/hal_init.c +1
-1@@ -382,7 +382,7 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)uint rtl871x_hal_init (struct _adapter *padapter) { padapter->hw_init_completed = false; -if (padapter->halpriv.hal_bus_init ==NULL ) +if (!padapter->halpriv.hal_bus_init)return _FAIL;if (padapter->halpriv.hal_bus_init (padapter) != _SUCCESS)return _FAIL;Nothing to do with the patch, but
_FAILand_SUCCESSdon't look like standard kernel return values. Maybe it is possible to improve this.
I've been checking about this but _FAIL and _SUCCESS are used in a lot of places as return values.
What do you suggest?
Signature · 1 line
Amitoj
Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
Quoted 29 lines · Amitoj Kaur Chawla
Quoted 11 lines · Julia Lawall
Quoted 9 lines · Amitoj Kaur Chawla
Remove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 388
Quoted 13 lines
drivers/staging/rtl8712/hal_init.c +1
-1@@ -382,7 +382,7 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)uint rtl871x_hal_init (struct _adapter *padapter) { padapter->hw_init_completed = false; -if (padapter->halpriv.hal_bus_init ==NULL ) +if (!padapter->halpriv.hal_bus_init)return _FAIL;if (padapter->halpriv.hal_bus_init (padapter) != _SUCCESS)return _FAIL;Nothing to do with the patch, but
_FAILand_SUCCESSdon't look like standard kernel return values. Maybe it is possible to improve this.
Quoted 3 lines
I've been checking about this but
_FAILand_SUCCESSare used in a lot of places as return values.
What do you suggest?
_FAIL is 0 and _SUCCESS is 1. In most of the kernel, failure is indicated by a descriptive error code, like -ENOMEM when some kind of memory allocation fails. It's probably not practical to change the whole driver at once. But perhaps you could find some functions that are only called from a few places, and make the change gradually.
julia
Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
Quoted 37 lines · Julia Lawall
Quoted 29 lines · Amitoj Kaur Chawla
Quoted 11 lines · Julia Lawall
Quoted 9 lines · Amitoj Kaur Chawla
Remove NULL comparison by using '!' operator. Problem found using checkpatch.pl
CHECK: Comparison to NULL could be written "!padapter->halpriv.hal_bus_init"Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/rtl8712/hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
drivers/staging/rtl8712/hal_init.c uint rtl8712_hal_deinit(struct _adapter *padapter) · line 388
Quoted 13 lines
drivers/staging/rtl8712/hal_init.c +1
-1@@ -382,7 +382,7 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)uint rtl871x_hal_init (struct _adapter *padapter) { padapter->hw_init_completed = false; -if (padapter->halpriv.hal_bus_init ==NULL ) +if (!padapter->halpriv.hal_bus_init)return _FAIL;if (padapter->halpriv.hal_bus_init (padapter) != _SUCCESS)return _FAIL;Nothing to do with the patch, but
_FAILand_SUCCESSdon't look like standard kernel return values. Maybe it is possible to improve this.Quoted 3 lines
I've been checking about this but
_FAILand_SUCCESSare used in a lot of places as return values.
What do you suggest?
Quoted 6 lines
_FAILis 0 and_SUCCESSis 1. In most of the kernel, failure is indicated by a descriptive error code, like-ENOMEMwhen some kind of memory allocation fails. It's probably not practical to change the whole driver at once. But perhaps you could find some functions that are only called from a few places, and make the change gradually.
Okay, I'll look into this.
Thanks,
Amitoj