* [PATCH 1/5] scsi: Fix assignment of 0/1 to bool variables
@ 2013-09-22 18:44 Peter Senna Tschudin
2013-09-23 0:29 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Peter Senna Tschudin @ 2013-09-22 18:44 UTC (permalink / raw)
To: JBottomley
Cc: naresh, davem, jj, arvindb, hare, michaelc, vijay.chauhan,
bvanassche, linux-scsi, linux-kernel, kernel-janitors,
Peter Senna Tschudin
Convert 0 to false and 1 to true when assigning values to bool
variables. Inspired by commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2.
The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):
@@
bool b;
@@
(
-b = 0
+b = false
|
-b = 1
+b = true
)
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/scsi/csiostor/csio_hw.c | 4 ++--
drivers/scsi/cxgbi/libcxgbi.c | 4 ++--
drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff -u -p a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1603,7 +1603,7 @@ static int skb_read_pdu_data(struct iscs
struct sk_buff *skb, unsigned int offset)
{
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
- bool offloaded = 0;
+ bool offloaded = false;
int opcode = tcp_conn->in.hdr->opcode & ISCSI_OPCODE_MASK;
log_debug(1 << CXGBI_DBG_PDU_RX,
@@ -1626,7 +1626,7 @@ static int skb_read_pdu_data(struct iscs
offset += ISCSI_DIGEST_SIZE;
if (cxgbi_skcb_test_flag(lskb, SKCBF_RX_DATA_DDPD))
- offloaded = 1;
+ offloaded = true;
if (opcode == ISCSI_OP_SCSI_DATA_IN)
log_debug(1 << CXGBI_DBG_PDU_RX,
diff -u -p a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -528,7 +528,7 @@ static int alua_rtpg(struct scsi_device
int len, k, off, valid_states = 0;
unsigned char *ucp;
unsigned err;
- bool rtpg_ext_hdr_req = 1;
+ bool rtpg_ext_hdr_req = true;
unsigned long expiry, interval = 0;
unsigned int tpg_desc_tbl_off;
unsigned char orig_transition_tmo;
@@ -558,7 +558,7 @@ static int alua_rtpg(struct scsi_device
if (rtpg_ext_hdr_req == 1 &&
sense_hdr.sense_key == ILLEGAL_REQUEST &&
sense_hdr.asc == 0x24 && sense_hdr.ascq == 0) {
- rtpg_ext_hdr_req = 0;
+ rtpg_ext_hdr_req = false;
goto retry;
}
diff -u -p a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -3476,7 +3476,7 @@ csio_process_fwevtq_entry(struct csio_hw
__u8 op;
void *msg = NULL;
uint32_t msg_len = 0;
- bool msg_sg = 0;
+ bool msg_sg = false;
op = ((struct rss_header *) wr)->opcode;
if (op == CPL_FW6_PLD) {
@@ -3488,7 +3488,7 @@ csio_process_fwevtq_entry(struct csio_hw
msg = (void *) flb;
msg_len = flb->totlen;
- msg_sg = 1;
+ msg_sg = true;
} else if (op == CPL_FW6_MSG || op == CPL_FW4_MSG) {
CSIO_INC_STATS(hw, n_cpl_fw6_msg);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/5] scsi: Fix assignment of 0/1 to bool variables
2013-09-22 18:44 [PATCH 1/5] scsi: Fix assignment of 0/1 to bool variables Peter Senna Tschudin
@ 2013-09-23 0:29 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2013-09-23 0:29 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: JBottomley, naresh, davem, jj, arvindb, hare, michaelc,
vijay.chauhan, bvanassche, linux-scsi, linux-kernel,
kernel-janitors
On Sun, 2013-09-22 at 20:44 +0200, Peter Senna Tschudin wrote:
> Convert 0 to false and 1 to true when assigning values to bool
> variables. Inspired by commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2.
[]
> @@
> bool b;
> @@
> -b = 1
> +b = true
You might also look for non-zero values other than 1
and convert those true too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-23 0:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-22 18:44 [PATCH 1/5] scsi: Fix assignment of 0/1 to bool variables Peter Senna Tschudin
2013-09-23 0:29 ` Joe Perches
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).