* [PATCH] scsi: FlashPoint: Remove unnecessary parentheses
@ 2018-09-20 21:10 Nathan Chancellor
2018-09-21 15:19 ` Khalid Aziz
2018-09-26 0:47 ` Martin K. Petersen
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-09-20 21:10 UTC (permalink / raw)
To: Khalid Aziz, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, Nathan Chancellor
Clang warns when multiple pairs of parentheses are used for a single
conditional statement.
In file included from drivers/scsi/BusLogic.c:57:
drivers/scsi/FlashPoint.c:2947:34: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
drivers/scsi/FlashPoint.c:2947:34: note: remove extraneous parentheses around the comparison to silence this warning
if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
~ ^ ~
drivers/scsi/FlashPoint.c:2947:34: note: use '=' to turn this equality comparison into an assignment
if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
^~
=
drivers/scsi/FlashPoint.c:2956:39: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
else if ((currSCCB->Sccb_scsistat ==
~~~~~~~~~~~~~~~~~~~~~~~~^~
drivers/scsi/FlashPoint.c:2956:39: note: remove extraneous parentheses around the comparison to silence this warning
else if ((currSCCB->Sccb_scsistat ==
~ ^
drivers/scsi/FlashPoint.c:2956:39: note: use '=' to turn this equality comparison into an assignment
else if ((currSCCB->Sccb_scsistat ==
^~
=
2 warnings generated.
Link: https://github.com/ClangBuiltLinux/linux/issues/156
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/scsi/FlashPoint.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index 867b864f5047..0f17bd51088a 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -2944,7 +2944,7 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card)
}
if (currSCCB->Lun == 0x00) {
- if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
+ if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
currTar_Info->TarStatus |=
(unsigned char)SYNC_SUPPORTED;
@@ -2953,8 +2953,8 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card)
~EE_SYNC_MASK;
}
- else if ((currSCCB->Sccb_scsistat ==
- SELECT_WN_ST)) {
+ else if (currSCCB->Sccb_scsistat ==
+ SELECT_WN_ST) {
currTar_Info->TarStatus =
(currTar_Info->
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: FlashPoint: Remove unnecessary parentheses
2018-09-20 21:10 [PATCH] scsi: FlashPoint: Remove unnecessary parentheses Nathan Chancellor
@ 2018-09-21 15:19 ` Khalid Aziz
2018-09-21 18:17 ` Nathan Chancellor
2018-09-26 0:47 ` Martin K. Petersen
1 sibling, 1 reply; 4+ messages in thread
From: Khalid Aziz @ 2018-09-21 15:19 UTC (permalink / raw)
To: Nathan Chancellor, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel
On 09/20/2018 03:10 PM, Nathan Chancellor wrote:
> Clang warns when multiple pairs of parentheses are used for a single
> conditional statement.
>
> In file included from drivers/scsi/BusLogic.c:57:
> drivers/scsi/FlashPoint.c:2947:34: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
> if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> drivers/scsi/FlashPoint.c:2947:34: note: remove extraneous parentheses around the comparison to silence this warning
> if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> ~ ^ ~
> drivers/scsi/FlashPoint.c:2947:34: note: use '=' to turn this equality comparison into an assignment
> if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> ^~
> =
> drivers/scsi/FlashPoint.c:2956:39: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
> else if ((currSCCB->Sccb_scsistat ==
> ~~~~~~~~~~~~~~~~~~~~~~~~^~
> drivers/scsi/FlashPoint.c:2956:39: note: remove extraneous parentheses around the comparison to silence this warning
> else if ((currSCCB->Sccb_scsistat ==
> ~ ^
> drivers/scsi/FlashPoint.c:2956:39: note: use '=' to turn this equality comparison into an assignment
> else if ((currSCCB->Sccb_scsistat ==
> ^~
> =
> 2 warnings generated.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/156
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/scsi/FlashPoint.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
There are more places in this file with extraneous parentheses, for example:
952 if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1))
953 return (int)FAILURE;
954
955 if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0))
956 return (int)FAILURE;
957
958 if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1))
Wonder why the compiler does not complain about these, but this patch is
good for now. I will clean up the rest in another patch.
James, Martin, please pull this patch into the scsi tree.
Acked-by: Khalid Aziz <khalid@gonehiking.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: FlashPoint: Remove unnecessary parentheses
2018-09-21 15:19 ` Khalid Aziz
@ 2018-09-21 18:17 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-09-21 18:17 UTC (permalink / raw)
To: Khalid Aziz
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, linux-kernel
On Fri, Sep 21, 2018 at 09:19:40AM -0600, Khalid Aziz wrote:
> On 09/20/2018 03:10 PM, Nathan Chancellor wrote:
> > Clang warns when multiple pairs of parentheses are used for a single
> > conditional statement.
> >
> > In file included from drivers/scsi/BusLogic.c:57:
> > drivers/scsi/FlashPoint.c:2947:34: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
> > if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> > ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> > drivers/scsi/FlashPoint.c:2947:34: note: remove extraneous parentheses around the comparison to silence this warning
> > if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> > ~ ^ ~
> > drivers/scsi/FlashPoint.c:2947:34: note: use '=' to turn this equality comparison into an assignment
> > if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
> > ^~
> > =
> > drivers/scsi/FlashPoint.c:2956:39: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
> > else if ((currSCCB->Sccb_scsistat ==
> > ~~~~~~~~~~~~~~~~~~~~~~~~^~
> > drivers/scsi/FlashPoint.c:2956:39: note: remove extraneous parentheses around the comparison to silence this warning
> > else if ((currSCCB->Sccb_scsistat ==
> > ~ ^
> > drivers/scsi/FlashPoint.c:2956:39: note: use '=' to turn this equality comparison into an assignment
> > else if ((currSCCB->Sccb_scsistat ==
> > ^~
> > =
> > 2 warnings generated.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/156
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/scsi/FlashPoint.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
>
> There are more places in this file with extraneous parentheses, for example:
>
> 952 if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1))
> 953 return (int)FAILURE;
> 954
> 955 if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0))
> 956 return (int)FAILURE;
> 957
> 958 if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1))
>
> Wonder why the compiler does not complain about these, but this patch is
> good for now. I will clean up the rest in another patch.
>
> James, Martin, please pull this patch into the scsi tree.
>
> Acked-by: Khalid Aziz <khalid@gonehiking.org>
Hi Khalid,
Clang only warns about this construct when the left hand is a variable
because it thinks that an assignment may have been intended so macros
and functions don't trigger it.
Thank you for the review, I appreciate it,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: FlashPoint: Remove unnecessary parentheses
2018-09-20 21:10 [PATCH] scsi: FlashPoint: Remove unnecessary parentheses Nathan Chancellor
2018-09-21 15:19 ` Khalid Aziz
@ 2018-09-26 0:47 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2018-09-26 0:47 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Khalid Aziz, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, linux-kernel
Nathan,
> Clang warns when multiple pairs of parentheses are used for a single
> conditional statement.
Applied to 4.20/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-26 0:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 21:10 [PATCH] scsi: FlashPoint: Remove unnecessary parentheses Nathan Chancellor
2018-09-21 15:19 ` Khalid Aziz
2018-09-21 18:17 ` Nathan Chancellor
2018-09-26 0:47 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).