diff options
author | Quentin Lambert <lambert.quentin@gmail.com> | 2015-03-04 13:31:01 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-07 04:25:00 +0300 |
commit | de904bf0e4610a7651f3eb0c8b7b63e2ae32b805 (patch) | |
tree | 0c142eb07b73dfafab3d5083e8eb98e13fde16dc /drivers/staging/rts5208/ms.c | |
parent | 6725e52d22a4d99ea752fa0d0422a3a544545b03 (diff) | |
download | linux-de904bf0e4610a7651f3eb0c8b7b63e2ae32b805.tar.xz |
staging: rts5208: Convert non-returned local variable to boolean when relevant
This patch was produced using Coccinelle. A simplified version of the
semantic patch is:
@r exists@
identifier f;
local idexpression u8 x;
identifier xname;
@@
f(...) {
...when any
(
x@xname = 1;
|
x@xname = 0;
)
...when any
}
@bad exists@
identifier r.f;
local idexpression u8 r.x
expression e1 != {0, 1}, e2;
@@
f(...) {
...when any
(
x = e1;
|
x + e2
)
...when any
}
@depends on !bad@
identifier r.f;
local idexpression u8 r.x;
identifier r.xname;
@@
f(...) {
...
++ bool xname;
- int xname;
<...
(
x =
- 1
+ true
|
x =
- -1
+ false
)
...>
}
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208/ms.c')
-rw-r--r-- | drivers/staging/rts5208/ms.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c index a47a19135d49..050bc4709c36 100644 --- a/drivers/staging/rts5208/ms.c +++ b/drivers/staging/rts5208/ms.c @@ -1560,7 +1560,8 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, u16 log_blk, u8 start_page, u8 end_page) { struct ms_info *ms_card = &(chip->ms_card); - int retval, rty_cnt, uncorrect_flag = 0; + bool uncorrect_flag = false; + int retval, rty_cnt; u8 extra[MS_EXTRA_SIZE], val, i, j, data[16]; dev_dbg(rtsx_dev(chip), "Copy page from 0x%x to 0x%x, logical block is 0x%x\n", @@ -1642,10 +1643,10 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk, if (val & INT_REG_ERR) { retval = ms_read_status_reg(chip); if (retval != STATUS_SUCCESS) { - uncorrect_flag = 1; + uncorrect_flag = true; dev_dbg(rtsx_dev(chip), "Uncorrectable error\n"); } else { - uncorrect_flag = 0; + uncorrect_flag = false; } retval = ms_transfer_tpc(chip, @@ -2187,7 +2188,8 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) { struct ms_info *ms_card = &(chip->ms_card); struct zone_entry *segment; - int retval, table_size, disable_cnt, defect_flag, i; + bool defect_flag; + int retval, table_size, disable_cnt, i; u16 start, end, phy_blk, log_blk, tmp_blk; u8 extra[MS_EXTRA_SIZE], us1, us2; @@ -2236,10 +2238,10 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no) for (phy_blk = start; phy_blk < end; phy_blk++) { if (disable_cnt) { - defect_flag = 0; + defect_flag = false; for (i = 0; i < segment->disable_count; i++) { if (phy_blk == segment->defect_list[i]) { - defect_flag = 1; + defect_flag = true; break; } } |