scsi: Fix assignment of 0/1 to bool variables
Subsystems (9)
PATCH 1/5 scsi: Fix assignment of 0/1 to bool variables
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
)
--- 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(-)
drivers/scsi/cxgbi/libcxgbi.c +2 -2
@@ -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,
drivers/scsi/device_handler/scsi_dh_alua.c +2 -2
@@ -528,7 +528,7 @@ static int alua_rtpg(struct scsi_deviceint 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_deviceif (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; }
drivers/scsi/csiostor/csio_hw.c +2 -2
@@ -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);
PATCH 2/5 Bluetooth: Fix assignment of 0/1 to bool variables
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
)
--- net/bluetooth/l2cap_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/bluetooth/l2cap_core.c +8 -8
@@ -5797,7 +5797,7 @@ static int l2cap_rx_state_recv(struct l2 struct sk_buff *skb, u8 event) { int err = 0; -bool skb_in_use =0 ; +bool skb_in_use = false;BT_DBG ("chan %p, control %p, skb %p, event %d" , chan, control, skb, event);
@@ -5818,7 +5818,7 @@ static int l2cap_rx_state_recv(struct l2 control->txseq); chan->buffer_seq = chan->expected_tx_seq; - skb_in_use =1 ; + skb_in_use = true; err =l2cap_reassemble_sdu (chan, skb, control);if (err)
@@ -5854,7 +5854,7 @@ static int l2cap_rx_state_recv(struct l2* current frame is stored for later use. */ skb_queue_tail (&chan->srej_q, skb); - skb_in_use =1 ; + skb_in_use = true;BT_DBG ("Queued %p (queue len %d)" , skb,skb_queue_len (&chan->srej_q));
@@ -5932,7 +5932,7 @@ static int l2cap_rx_state_srej_sent(stru {int err =0 ;u16 txseq = control->txseq; -bool skb_in_use =0 ; +bool skb_in_use = false;BT_DBG ("chan %p, control %p, skb %p, event %d" , chan, control, skb, event);
@@ -5944,7 +5944,7 @@ static int l2cap_rx_state_srej_sent(stru/* Keep frame for reassembly later */ l2cap_pass_to_tx (chan, control);skb_queue_tail (&chan->srej_q, skb); - skb_in_use =1 ; + skb_in_use = true;BT_DBG ("Queued %p (queue len %d)" , skb,skb_queue_len (&chan->srej_q));
@@ -5955,7 +5955,7 @@ static int l2cap_rx_state_srej_sent(strul2cap_pass_to_tx (chan, control);skb_queue_tail (&chan->srej_q, skb); - skb_in_use =1 ; + skb_in_use = true;BT_DBG ("Queued %p (queue len %d)" , skb,skb_queue_len (&chan->srej_q));
@@ -5970,7 +5970,7 @@ static int l2cap_rx_state_srej_sent(stru* the missing frames. */ skb_queue_tail (&chan->srej_q, skb); - skb_in_use =1 ; + skb_in_use = true;BT_DBG ("Queued %p (queue len %d)" , skb,skb_queue_len (&chan->srej_q));
@@ -5984,7 +5984,7 @@ static int l2cap_rx_state_srej_sent(stru* SREJ'd frames. */ skb_queue_tail (&chan->srej_q, skb); - skb_in_use =1 ; + skb_in_use = true;BT_DBG ("Queued %p (queue len %d)" , skb,skb_queue_len (&chan->srej_q));
Re: [PATCH 2/5] Bluetooth: Fix assignment of 0/1 to bool variables
Hi Peter,
Quoted 17 lines
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;
@@
((quoted diff) +1
-1-b = 0 +b = false|
(quoted diff) +1
-1-b = 1 +b = true)
Quoted 5 lines
Signed-off-by Peter Senna Tschudin <[email protected]>---
net/bluetooth/l2cap_core.c| 16 ++++++++--------1 file changed, 8 insertions(+), 8 deletions(-)
Regards
Marcel
Re: [PATCH 2/5] Bluetooth: Fix assignment of 0/1 to bool variables
In reply to Peter Senna TschudinHi Peter,
2013-09-22 Peter Senna Tschudin <[email protected]>:
Quoted 17 lines
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;
@@
((quoted diff) +1
-1-b = 0 +b = false|
(quoted diff) +1
-1-b = 1 +b = true)
Quoted 5 lines
Signed-off-by Peter Senna Tschudin <[email protected]>--- net/bluetooth/l2cap_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
PATCH 3/5 OMAPDSS: DISPC: Fix assignment of 0/1 to bool variables
In reply to Peter Senna TschudinConvert 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
)
--- drivers/video/omap2/dss/dispc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/omap2/dss/dispc.c +4 -4
@@ -2352,7 +2352,7 @@ int dispc_ovl_check(enum omap_plane plan {enum omap_overlay_caps caps =dss_feat_get_overlay_caps (plane);bool five_taps = true; -bool fieldmode =0 ; +bool fieldmode = false;u16 in_height = oi->height;u16 in_width = oi->width;bool ilace = timings->interlace;
@@ -2365,7 +2365,7 @@ int dispc_ovl_check(enum omap_plane plan out_height = oi->out_height =0 ? oi->height : oi->out_height;if (ilace && oi->height = out_height) - fieldmode =1 ; + fieldmode = true;if (ilace) {if (fieldmode)
@@ -2396,7 +2396,7 @@ static int dispc_ovl_setup_common(enum o bool mem_to_mem) {bool five_taps = true; -bool fieldmode =0 ; +bool fieldmode = false;int r, cconv =0 ;unsigned offset0, offset1;s32 row_inc;
@@ -2417,7 +2417,7 @@ static int dispc_ovl_setup_common(enum o out_height = out_height =0 ? height : out_height;if (ilace && height = out_height) - fieldmode =1 ; + fieldmode = true;if (ilace) {if (fieldmode)
Tomi Valkeinen
AppliedRe: [PATCH 3/5] OMAPDSS: DISPC: Fix assignment of 0/1 to bool variables
Hi,
Quoted 5 lines · 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/):
Thanks, applied for 3.13. Although "fix" and "problem" are perhaps a bit too strong words, as this is just a cosmetic change =).
Tomi
PATCH 4/5 ALSA: Fix assignment of 0/1 to bool variables
In reply to Peter Senna TschudinConvert 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
)
--- sound/pci/azt3328.c | 14 +++++++------- sound/usb/mixer.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-)
sound/usb/mixer.c +2 -2
@@ -1151,14 +1151,14 @@ static void check_no_speaker_on_headset(const char *names_to_check[] = {"Headset" ,"headset" ,"Headphone" ,"headphone" ,NULL };const char **s; -bool found =0 ; +bool found = false;if (strcmp ("Speaker" , kctl->id.name))return ;for (s = names_to_check; *s; s++)if (strstr (card->shortname, *s)) { - found =1 ; + found = true;break ; }
sound/pci/azt3328.c +7 -7
@@ -715,14 +715,14 @@ snd_azf3328_mixer_ac97_read(struct snd_aconst struct snd_azf3328 *chip = ac97->private_data;unsigned short reg_azf =snd_azf3328_mixer_ac97_map_reg_idx (reg_ac97);unsigned short reg_val =0 ; -bool unsupported =0 ; +bool unsupported = false;snd_azf3328_dbgmixer ("snd_azf3328_mixer_ac97_read reg_ac97 %u\n" , reg_ac97 );if (reg_azf &AZF_AC97_REG_UNSUPPORTED ) - unsupported =1 ; + unsupported = true;else {if (reg_azf &AZF_AC97_REG_REAL_IO_READ ) reg_val = snd_azf3328_mixer_inw(chip,
@@ -759,7 +759,7 @@ snd_azf3328_mixer_ac97_read(struct snd_a reg_val = azf_emulated_ac97_vendor_id &0xffff ;break ;default : - unsupported =1 ; + unsupported = true;break ; } }
@@ -776,14 +776,14 @@ snd_azf3328_mixer_ac97_write(struct snd_ {const struct snd_azf3328 *chip = ac97->private_data;unsigned short reg_azf =snd_azf3328_mixer_ac97_map_reg_idx (reg_ac97); -bool unsupported =0 ; +bool unsupported = false;snd_azf3328_dbgmixer ("snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n" , reg_ac97, val );if (reg_azf &AZF_AC97_REG_UNSUPPORTED ) - unsupported =1 ; + unsupported = true;else {if (reg_azf &AZF_AC97_REG_REAL_IO_WRITE ) snd_azf3328_mixer_outw(
@@ -808,7 +808,7 @@ snd_azf3328_mixer_ac97_write(struct snd_*/ break ;default : - unsupported =1 ; + unsupported = true;break ; } }
@@ -1559,7 +1559,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_sstruct snd_azf3328_codec_data *codec = runtime->private_data;int result =0 ;u16 flags1; -bool previously_muted =0 ; +bool previously_muted = false;bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);snd_azf3328_dbgcalls ("snd_azf3328_pcm_trigger cmd %d\n" , cmd);
Takashi Iwai
AppliedRe: [PATCH 4/5] ALSA: Fix assignment of 0/1 to bool variables
At Sun, 22 Sep 2013 20:44:12 +0200,
Quoted 18 lines · 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;
@@
((quoted diff) +1
-1-b = 0 +b = false|
(quoted diff) +1
-1-b = 1 +b = true)
Quoted 1 line
Signed-off-by Peter Senna Tschudin <[email protected]>
Thanks, applied now.
Takashi
Quoted 91 lines
--- sound/pci/azt3328.c | 14 +++++++------- sound/usb/mixer.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-)diff -u -p
a/sound/usb/mixer.cb/sound/usb/mixer.csound/usb/mixer.c +2
-2@@ -1151,14 +1151,14 @@ static void check_no_speaker_on_headset(const char *names_to_check[] = {"Headset" ,"headset" ,"Headphone" ,"headphone" ,NULL };const char **s; -bool found =0 ; +bool found = false;if (strcmp ("Speaker" , kctl->id.name))return ;for (s = names_to_check; *s; s++)if (strstr (card->shortname, *s)) { - found =1 ; + found = true;break ; }diff -u -p
a/sound/pci/azt3328.cb/sound/pci/azt3328.csound/pci/azt3328.c +7
-7@@ -715,14 +715,14 @@ snd_azf3328_mixer_ac97_read(struct snd_aconst struct snd_azf3328 *chip = ac97->private_data;unsigned short reg_azf =snd_azf3328_mixer_ac97_map_reg_idx (reg_ac97);unsigned short reg_val =0 ; -bool unsupported =0 ; +bool unsupported = false;snd_azf3328_dbgmixer ("snd_azf3328_mixer_ac97_read reg_ac97 %u\n" , reg_ac97 );if (reg_azf &AZF_AC97_REG_UNSUPPORTED ) - unsupported =1 ; + unsupported = true;else {if (reg_azf &AZF_AC97_REG_REAL_IO_READ ) reg_val = snd_azf3328_mixer_inw(chip,@@ -759,7 +759,7 @@ snd_azf3328_mixer_ac97_read(struct snd_a reg_val = azf_emulated_ac97_vendor_id &0xffff ;break ;default : - unsupported =1 ; + unsupported = true;break ; } }@@ -776,14 +776,14 @@ snd_azf3328_mixer_ac97_write(struct snd_ {const struct snd_azf3328 *chip = ac97->private_data;unsigned short reg_azf =snd_azf3328_mixer_ac97_map_reg_idx (reg_ac97); -bool unsupported =0 ; +bool unsupported = false;snd_azf3328_dbgmixer ("snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n" , reg_ac97, val );if (reg_azf &AZF_AC97_REG_UNSUPPORTED ) - unsupported =1 ; + unsupported = true;else {if (reg_azf &AZF_AC97_REG_REAL_IO_WRITE ) snd_azf3328_mixer_outw(@@ -808,7 +808,7 @@ snd_azf3328_mixer_ac97_write(struct snd_*/ break ;default : - unsupported =1 ; + unsupported = true;break ; } }@@ -1559,7 +1559,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_sstruct snd_azf3328_codec_data *codec = runtime->private_data;int result =0 ;u16 flags1; -bool previously_muted =0 ; +bool previously_muted = false;bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);snd_azf3328_dbgcalls ("snd_azf3328_pcm_trigger cmd %d\n" , cmd);
PATCH 5/5 Staging: crystalhd: Fix assignment of 0/1 to bool variables
In reply to Peter Senna TschudinConvert 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
)
--- drivers/staging/crystalhd/crystalhd_hw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/crystalhd/crystalhd_hw.c +4 -4
@@ -1517,7 +1517,7 @@ static void crystalhd_rx_isr(struct crysuint32_t i, list_avail =0 ;enum BC_STATUS comp_sts =BC_STS_NO_DATA ;uint32_t y_err_sts, uv_err_sts, y_dn_sz =0 , uv_dn_sz =0 ; -bool ret =0 ; +bool ret = false;if (!hw) {BCMLOG_ERR ("Invalid Arguments\n" );
@@ -1852,7 +1852,7 @@ bool crystalhd_hw_interrupt(struct cryst {uint32_t intr_sts =0 ;uint32_t deco_intr =0 ; -bool rc =0 ; +bool rc = false;if (!adp || !hw->dev_started)return rc;
@@ -1865,7 +1865,7 @@ bool crystalhd_hw_interrupt(struct crystif (intr_sts) {/* let system know we processed interrupt..*/ - rc =1 ; + rc = true; hw->stats.dev_interrupts++; }
@@ -1886,7 +1886,7 @@ bool crystalhd_hw_interrupt(struct cryst/* FIXME: jarod: No udelay? might this be the real reason mini pci-e cards were stalling out? */ bc_dec_reg_wr (adp, Stream2Host_Intr_Sts,0 ); - rc =1 ; + rc = true; }/* Rx interrupts */
Quoted 2 lines · Peter Senna Tschudin
Convert 0 to false and 1 to true when assigning values to bool variables. Inspired by commit
3db1cd5c05f35fb43eb134df6f321de4e63141f2.
[]
Review
Quoted 5 lines
@@
bool b;
@@(quoted diff) +1
-1-b = 1 +b = true
You might also look for non-zero values other than 1 and convert those true too.