* [PATCH 0/2] Remove Explicit NULL Comparison
@ 2015-10-07 5:23 Amitoj Kaur Chawla
2015-10-07 5:26 ` [PATCH 1/2] staging: rtl8712: Remove NULL comparison Amitoj Kaur Chawla
2015-10-07 5:28 ` [PATCH 2/2] " Amitoj Kaur Chawla
0 siblings, 2 replies; 7+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-07 5:23 UTC (permalink / raw)
To: outreachy-kernel
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(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] staging: rtl8712: Remove NULL comparison
2015-10-07 5:23 [PATCH 0/2] Remove Explicit NULL Comparison Amitoj Kaur Chawla
@ 2015-10-07 5:26 ` Amitoj Kaur Chawla
2015-10-07 5:28 ` [PATCH 2/2] " Amitoj Kaur Chawla
1 sibling, 0 replies; 7+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-07 5:26 UTC (permalink / raw)
To: outreachy-kernel
Remove NULL comparison by using '!' operator. Problem found
using checkpatch.pl
CHECK: Comparison to NULL could be written "!ptmpchar"
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/staging/rtl8712/hal_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 897dc77..957f033 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -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 -
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] staging: rtl8712: Remove NULL comparison
2015-10-07 5:23 [PATCH 0/2] Remove Explicit NULL Comparison Amitoj Kaur Chawla
2015-10-07 5:26 ` [PATCH 1/2] staging: rtl8712: Remove NULL comparison Amitoj Kaur Chawla
@ 2015-10-07 5:28 ` Amitoj Kaur Chawla
2015-10-08 7:11 ` [Outreachy kernel] " Julia Lawall
1 sibling, 1 reply; 7+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-07 5:28 UTC (permalink / raw)
To: outreachy-kernel
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 <amitoj1606@gmail.com>
---
drivers/staging/rtl8712/hal_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 957f033..081f361 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -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;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
2015-10-07 5:28 ` [PATCH 2/2] " Amitoj Kaur Chawla
@ 2015-10-08 7:11 ` Julia Lawall
2015-10-09 18:59 ` Amitoj Kaur Chawla
0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2015-10-08 7:11 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: outreachy-kernel
On Wed, 7 Oct 2015, Amitoj Kaur Chawla wrote:
> 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 <amitoj1606@gmail.com>
> ---
> drivers/staging/rtl8712/hal_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
> index 957f033..081f361 100644
> --- a/drivers/staging/rtl8712/hal_init.c
> +++ b/drivers/staging/rtl8712/hal_init.c
> @@ -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
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
2015-10-08 7:11 ` [Outreachy kernel] " Julia Lawall
@ 2015-10-09 18:59 ` Amitoj Kaur Chawla
2015-10-09 19:37 ` Julia Lawall
0 siblings, 1 reply; 7+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-09 18:59 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel
On Thu, Oct 8, 2015 at 12:41 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Wed, 7 Oct 2015, Amitoj Kaur Chawla wrote:
>
>> 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 <amitoj1606@gmail.com>
>> ---
>> drivers/staging/rtl8712/hal_init.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
>> index 957f033..081f361 100644
>> --- a/drivers/staging/rtl8712/hal_init.c
>> +++ b/drivers/staging/rtl8712/hal_init.c
>> @@ -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.
>
I've been checking about this but _FAIL and _SUCCESS are used in a lot
of places as return values.
What do you suggest?
--
Amitoj
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
2015-10-09 18:59 ` Amitoj Kaur Chawla
@ 2015-10-09 19:37 ` Julia Lawall
2015-10-09 19:42 ` Amitoj Kaur Chawla
0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2015-10-09 19:37 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: outreachy-kernel
On Sat, 10 Oct 2015, Amitoj Kaur Chawla wrote:
> On Thu, Oct 8, 2015 at 12:41 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > On Wed, 7 Oct 2015, Amitoj Kaur Chawla wrote:
> >
> >> 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 <amitoj1606@gmail.com>
> >> ---
> >> drivers/staging/rtl8712/hal_init.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
> >> index 957f033..081f361 100644
> >> --- a/drivers/staging/rtl8712/hal_init.c
> >> +++ b/drivers/staging/rtl8712/hal_init.c
> >> @@ -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.
> >
> I've been checking about this but _FAIL and _SUCCESS are 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: rtl8712: Remove NULL comparison
2015-10-09 19:37 ` Julia Lawall
@ 2015-10-09 19:42 ` Amitoj Kaur Chawla
0 siblings, 0 replies; 7+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-09 19:42 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel
On Sat, Oct 10, 2015 at 1:07 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sat, 10 Oct 2015, Amitoj Kaur Chawla wrote:
>
>> On Thu, Oct 8, 2015 at 12:41 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> > On Wed, 7 Oct 2015, Amitoj Kaur Chawla wrote:
>> >
>> >> 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 <amitoj1606@gmail.com>
>> >> ---
>> >> drivers/staging/rtl8712/hal_init.c | 2 +-
>> >> 1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
>> >> index 957f033..081f361 100644
>> >> --- a/drivers/staging/rtl8712/hal_init.c
>> >> +++ b/drivers/staging/rtl8712/hal_init.c
>> >> @@ -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.
>> >
>> I've been checking about this but _FAIL and _SUCCESS are 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.
>
Okay, I'll look into this.
Thanks,
Amitoj
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-10-09 19:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 5:23 [PATCH 0/2] Remove Explicit NULL Comparison Amitoj Kaur Chawla
2015-10-07 5:26 ` [PATCH 1/2] staging: rtl8712: Remove NULL comparison Amitoj Kaur Chawla
2015-10-07 5:28 ` [PATCH 2/2] " Amitoj Kaur Chawla
2015-10-08 7:11 ` [Outreachy kernel] " Julia Lawall
2015-10-09 18:59 ` Amitoj Kaur Chawla
2015-10-09 19:37 ` Julia Lawall
2015-10-09 19:42 ` Amitoj Kaur Chawla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.