1 | The patchset modifies unnecessary duplicate NULL test on a | 1 | The patchset modifies unnecessary duplicate NULL tests on a value in an |
---|---|---|---|
2 | value in an expression, when the value has been NULL tested in a | 2 | expression, when the value has been NULL tested in a previous expression. |
3 | previous expression. | ||
4 | 3 | ||
5 | Changes in v2: | 4 | - Changes in v3: |
6 | - Suggested by Andy Shevchenko. | 5 | - Changed other cases to use modulo (% 4096) over (& 0xfff). |
7 | 6 | - Modified commit message to reflect these changes. | |
8 | * Dropped patch files for media drivers from patchset as it is | 7 | - Changes in v2: |
9 | not meant for outreachy applicants. | 8 | - Dropped patch files for media drivers from patchset as it is |
10 | * Added full-stop sign to text in commit message. | 9 | not meant for outreachy applicants. |
11 | * Added space around binary operators. | 10 | - Added full-stop sign to text in commit message. |
12 | * Made code more breadable by adding a line break. | 11 | - Made code more readable by adding a line break. |
13 | * Replace bitwise AND (&) with modulo (%) in expression. | 12 | - Changed cases to use modulo (% 4096) over (& 0xff). |
14 | 13 | - Changes in v1 | |
15 | Changes in v1: | 14 | - Patch for drivers/staging/media/av7110/sp8870.c and |
16 | - Suggested by Andy Shevchenko | 15 | drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c |
17 | 16 | is split into two different patches in the patchset for use by the different | |
18 | * Patch for drivers/staging/media/av7110/sp8870.c and | 17 | driver maintainers. |
19 | drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 18 | - Added subject title for each of the separated patches. |
20 | is split into two different patches in the patchset for use | 19 | - Patch 1: Removed unnecessary curly braces {} initially inserted. |
21 | by the different driver maintainers. | 20 | - Patch 2: Unnecessary {} was also removed for v1. |
22 | * Added subject title for each of the separated patch. | ||
23 | * Patch 1: Removed unnecessary curl braces {} initially inserted. | ||
24 | * Patch 2: Unnecessary {} was also removed for v1. | ||
25 | 21 | ||
26 | Abraham Samuel Adekunle (1): | 22 | Abraham Samuel Adekunle (1): |
27 | staging: rtl8723bs: Prevent duplicate NULL tests on a value | 23 | staging: rtl8723bs: Prevent duplicate NULL tests on a value |
28 | 24 | ||
29 | drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- | 25 | drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- |
30 | drivers/staging/rtl8723bs/core/rtw_xmit.c | 58 +++++++++---------- | 26 | drivers/staging/rtl8723bs/core/rtw_xmit.c | 58 +++++++++---------- |
31 | 2 files changed, 30 insertions(+), 30 deletions(-) | 27 | 2 files changed, 30 insertions(+), 30 deletions(-) |
32 | 28 | ||
33 | -- | 29 | -- |
34 | 2.34.1 | 30 | 2.34.1 | diff view generated by jsdifflib |
1 | When a value has been tested for NULL in an expression, a | 1 | When a value has been tested for NULL in an expression, a |
---|---|---|---|
2 | second NULL test on the same value in another expression | 2 | second NULL test on the same value in another expression |
3 | is unnecessary when the value has not been assigned NULL. | 3 | is unnecessary when the value has not been assigned NULL. |
4 | 4 | ||
5 | Remove unnecessary duplicate NULL tests on the same value that | 5 | Remove unnecessary duplicate NULL tests on the same value that |
6 | has previously been NULL tested. | 6 | has previously been NULL tested. |
7 | |||
8 | While at it, convert '& 0xfff' cases to use modulo operator and | ||
9 | decimal number to make the upper limit visible and clear what the | ||
10 | semantic of it is. | ||
7 | 11 | ||
8 | Found by Coccinelle. | 12 | Found by Coccinelle. |
9 | 13 | ||
10 | Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com> | 14 | Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com> |
11 | --- | 15 | --- |
... | ... | ||
83 | + /* check BA_starting_seqctrl */ | 87 | + /* check BA_starting_seqctrl */ |
84 | + if (SN_LESS(pattrib->seqnum, tx_seq)) { | 88 | + if (SN_LESS(pattrib->seqnum, tx_seq)) { |
85 | + pattrib->ampdu_en = false;/* AGG BK */ | 89 | + pattrib->ampdu_en = false;/* AGG BK */ |
86 | + } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { | 90 | + } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { |
87 | + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = | 91 | + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = |
88 | + (tx_seq + 1) & 0xfff; | 92 | + (tx_seq + 1) % 4096; |
89 | + | 93 | + |
90 | + pattrib->ampdu_en = true;/* AGG EN */ | 94 | + pattrib->ampdu_en = true;/* AGG EN */ |
91 | + } else { | 95 | + } else { |
92 | + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = | 96 | + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = |
93 | + (pattrib->seqnum + 1) % 4096; | 97 | + (pattrib->seqnum + 1) % 4096; |
94 | + pattrib->ampdu_en = true;/* AGG EN */ | 98 | + pattrib->ampdu_en = true;/* AGG EN */ |
95 | } | 99 | } |
96 | } | 100 | } |
97 | } | 101 | } |
98 | -- | 102 | -- |
99 | 2.34.1 | 103 | 2.34.1 | diff view generated by jsdifflib |