* [PATCH 2/2] Staging: rtl8712: Fix zero-testing pointer typed value
@ 2015-03-31 20:07 Amitoj Kaur Chawla
2015-04-01 15:25 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2015-03-31 20:07 UTC (permalink / raw)
To: outreachy-kernel
Removes variable comparison with 0 by using if statement. Done using following coccinelle script.
@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@
E = f(...)
<...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...>
?E = E1
@ disable is_zero,isnt_zero @
expression *E;
@@
(
E ==
- 0
+ NULL
|
E !=
- 0
+ NULL
|
- 0
+ NULL
== E
|
- 0
+ NULL
!= E
)
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/staging/rtl8712/rtl871x_mp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c
index 26201ea..bae3209 100644
--- a/drivers/staging/rtl8712/rtl871x_mp.c
+++ b/drivers/staging/rtl8712/rtl871x_mp.c
@@ -144,7 +144,7 @@ u32 r8712_bb_reg_read(struct _adapter *pAdapter, u16 offset)
iocmd.value = bb_addr;
iocmd.index = IOCMD_BB_READ_IDX;
bb_val = fw_iocmd_read(pAdapter, iocmd);
- if (shift != 0) {
+ if (shift) {
u32 bb_val2 = 0;
bb_val >>= (shift * 8);
@@ -166,7 +166,7 @@ u8 r8712_bb_reg_write(struct _adapter *pAdapter, u16 offset, u32 value)
iocmd.cmdclass = IOCMD_CLASS_BB_RF;
iocmd.value = bb_addr;
iocmd.index = IOCMD_BB_WRITE_IDX;
- if (shift != 0) {
+ if (shift) {
u32 oldValue = 0;
u32 newValue = value;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] Staging: rtl8712: Fix zero-testing pointer typed value
2015-03-31 20:07 [PATCH 2/2] Staging: rtl8712: Fix zero-testing pointer typed value Amitoj Kaur Chawla
@ 2015-04-01 15:25 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-04-01 15:25 UTC (permalink / raw)
To: Amitoj Kaur Chawla; +Cc: outreachy-kernel
On Wed, Apr 01, 2015 at 01:37:43AM +0530, Amitoj Kaur Chawla wrote:
> Removes variable comparison with 0 by using if statement. Done using following coccinelle script.
>
> @ disable is_zero,isnt_zero @
> expression *E;
> expression E1,f;
> @@
>
> E = f(...)
> <...
> (
> - E == 0
> + !E
> |
> - E != 0
> + E
> |
> - 0 == E
> + !E
> |
> - 0 != E
> + E
> )
> ...>
> ?E = E1
>
> @ disable is_zero,isnt_zero @
> expression *E;
> @@
>
> (
> E ==
> - 0
> + NULL
> |
> E !=
> - 0
> + NULL
> |
> - 0
> + NULL
> == E
> |
> - 0
> + NULL
> != E
> )
>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> drivers/staging/rtl8712/rtl871x_mp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
I don't see a patch 1/2 anywhere :(
Confused. Please resend properly.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-01 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 20:07 [PATCH 2/2] Staging: rtl8712: Fix zero-testing pointer typed value Amitoj Kaur Chawla
2015-04-01 15:25 ` [Outreachy kernel] " Greg KH
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.