Re: [PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check

2015-11-01 Thread Tim Gardner
On 10/30/2015 02:59 PM, Johannes Thumshirn wrote:
> Hi Tim,
> tim.gard...@canonical.com writes:
> 
>> From: Tim Gardner <tim.gard...@canonical.com>
>>
>> drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous':
>> drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only 
>> applied to the left hand side of comparison [-Wlogical-not-parentheses]
>>   WARN_ON(!length > 0);
>>
>> gcc version 5.2.1
> 
> This patch (or similar) was already posted on Oct 1 by Joel Stanley.
> See http://comments.gmane.org/gmane.linux.scsi/105462
> 
> Thanks,
> Johannes
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

Mechanical application of prarens makes that expression more complicated
then it needs to be. It is, after all, an unsigned integer.

rtg
-- 
Tim Gardner tim.gard...@canonical.com
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check

2015-10-30 Thread tim . gardner
From: Tim Gardner <tim.gard...@canonical.com>

drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous':
drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only applied 
to the left hand side of comparison [-Wlogical-not-parentheses]
  WARN_ON(!length > 0);

gcc version 5.2.1

Cc: Jayamohan Kallickal <jayamohan.kallic...@avagotech.com>
Cc: Minh Tran <minh.t...@avagotech.com>
Cc: John Soni Jose <sony.joh...@avagotech.com>
Cc: "James E.J. Bottomley" <jbottom...@odin.com>
Signed-off-by: Tim Gardner <tim.gard...@canonical.com>
---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..5cdcd29 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
 {
WARN_ON(!virtual_address);
WARN_ON(!physical_address);
-   WARN_ON(!length > 0);
+   WARN_ON(!length);
WARN_ON(!sgl);
 
sgl->va = virtual_address;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux/linux-next] [SCSI] mvsas: Fix compile warnings by using correct enums

2013-02-20 Thread Tim Gardner
Use enum symbols of the same value, but from the correct enum type definition.

Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Dan Williams dan.j.willi...@intel.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: Jack Wang jack_w...@usish.com
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Tim Gardner tim.gard...@canonical.com
---
 drivers/scsi/mvsas/mv_sas.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 078c639..90f3a77 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1153,10 +1153,10 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, 
int get_st)
phy-identify.device_type =
phy-att_dev_info  PORT_DEV_TYPE_MASK;
 
-   if (phy-identify.device_type == SAS_END_DEV)
+   if (phy-identify.device_type == SAS_END_DEVICE)
phy-identify.target_port_protocols =
SAS_PROTOCOL_SSP;
-   else if (phy-identify.device_type != NO_DEVICE)
+   else if (phy-identify.device_type != SAS_PHY_UNUSED)
phy-identify.target_port_protocols =
SAS_PROTOCOL_SMP;
if (oob_done)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux/linux-next] mpt2sas: _scsih_sas_broadcast_primitive_event: Quiet unused variable warning

2013-02-20 Thread Tim Gardner
If CONFIG_SCSI_MPT2SAS_LOGGING is undefined, then these warnings are emitted:

drivers/scsi/mpt2sas/mpt2sas_scsih.c: In function 
'_scsih_sas_broadcast_primitive_event':
drivers/scsi/mpt2sas/mpt2sas_scsih.c:5810:40: warning: unused variable 
'event_data' [-Wunused-variable]

Add __maybe_unused to the definition of event_data.

Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Tim Gardner tim.gard...@canonical.com
---
 drivers/scsi/mpt2sas/mpt2sas_scsih.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc92..416f907 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -5807,7 +5807,8 @@ _scsih_sas_broadcast_primitive_event(struct 
MPT2SAS_ADAPTER *ioc,
u32 termination_count;
u32 query_count;
Mpi2SCSITaskManagementReply_t *mpi_reply;
-   Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event-event_data;
+   Mpi2EventDataSasBroadcastPrimitive_t *event_data __maybe_unused =
+   fw_event-event_data;
u16 ioc_status;
unsigned long flags;
int r;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux/linux-next] aic94xx: asd_read_flash: Fix uninitialized variable warning

2013-02-20 Thread Tim Gardner
drivers/scsi/aic94xx/aic94xx_sds.c: In function 'asd_read_flash':
drivers/scsi/aic94xx/aic94xx_sds.c:597:21: warning: 'offs' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
drivers/scsi/aic94xx/aic94xx_sds.c:985:6: note: 'offs' was declared here

If asd_find_flash_de() fails, then 'offs' could be used without having been 
initialized.
Set 'offs' to zero which seems like the most reasonable value.

Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Tim Gardner tim.gard...@canonical.com
---
 drivers/scsi/aic94xx/aic94xx_sds.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c 
b/drivers/scsi/aic94xx/aic94xx_sds.c
index edb43fd..d11b4d7 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -1003,6 +1003,7 @@ static int asd_process_ctrl_a_user(struct asd_ha_struct 
*asd_ha,
}
 
size = sizeof(struct asd_ctrla_phy_settings);
+   offs = 0;
ps = dflt_ps;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html