* [PATCH] staging: lustre: fix sparse warnings on assignment
@ 2017-04-29 15:49 Valentin Vidic
2017-05-05 5:27 ` [lustre-devel] " Valentin Vidic
0 siblings, 1 reply; 3+ messages in thread
From: Valentin Vidic @ 2017-04-29 15:49 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman,
lustre-devel, devel, linux-kernel
Cc: Valentin Vidic
Fixes the following sparse warnings:
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: right side has type int
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: right side has type int
Replaces one final conversion with two conversions on flag assignment.
Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 09b469243d73..4e6c1202a957 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -2302,7 +2302,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
dp = kmap(ent_page);
memset(dp, 0, sizeof(*dp));
dp->ldp_hash_start = cpu_to_le64(offset);
- dp->ldp_flags |= LDF_COLLIDE;
+ dp->ldp_flags |= cpu_to_le32(LDF_COLLIDE);
area = dp + 1;
left_bytes = PAGE_SIZE - sizeof(*dp);
@@ -2380,8 +2380,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
ent_page = NULL;
} else {
if (ent == area)
- dp->ldp_flags |= LDF_EMPTY;
- dp->ldp_flags = cpu_to_le32(dp->ldp_flags);
+ dp->ldp_flags |= cpu_to_le32(LDF_EMPTY);
dp->ldp_hash_end = cpu_to_le64(hash_offset);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] staging: lustre: cleanup le32 assignment to ldp_flags
2017-04-29 15:49 [PATCH] staging: lustre: fix sparse warnings on assignment Valentin Vidic
@ 2017-05-05 5:27 ` Valentin Vidic
0 siblings, 0 replies; 3+ messages in thread
From: Valentin Vidic @ 2017-05-05 5:27 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman,
lustre-devel, devel, linux-kernel
Cc: Valentin Vidic
Introduces a local var to collect flags and convert
them to le32.
Fixes the following sparse warnings:
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: right side has type int
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: right side has type int
Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
Changes in v2: use a local var to collect flags
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 09b469243d73..bec8c1948fa0 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -2275,6 +2275,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
struct lu_fid master_fid = op_data->op_fid1;
struct obd_device *obd = exp->exp_obd;
__u64 hash_offset = offset;
+ __u32 ldp_flags;
struct page *min_ent_page = NULL;
struct page *ent_page = NULL;
struct lu_dirent *min_ent = NULL;
@@ -2302,7 +2303,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
dp = kmap(ent_page);
memset(dp, 0, sizeof(*dp));
dp->ldp_hash_start = cpu_to_le64(offset);
- dp->ldp_flags |= LDF_COLLIDE;
+ ldp_flags = LDF_COLLIDE;
area = dp + 1;
left_bytes = PAGE_SIZE - sizeof(*dp);
@@ -2380,8 +2381,8 @@ static int lmv_read_striped_page(struct obd_export *exp,
ent_page = NULL;
} else {
if (ent == area)
- dp->ldp_flags |= LDF_EMPTY;
- dp->ldp_flags = cpu_to_le32(dp->ldp_flags);
+ ldp_flags |= LDF_EMPTY;
+ dp->ldp_flags |= cpu_to_le32(ldp_flags);
dp->ldp_hash_end = cpu_to_le64(hash_offset);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [lustre-devel] [PATCH v2] staging: lustre: cleanup le32 assignment to ldp_flags
@ 2017-05-05 5:27 ` Valentin Vidic
0 siblings, 0 replies; 3+ messages in thread
From: Valentin Vidic @ 2017-05-05 5:27 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman,
lustre-devel, devel, linux-kernel
Cc: Valentin Vidic
Introduces a local var to collect flags and convert
them to le32.
Fixes the following sparse warnings:
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: right side has type int
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |=
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: left side has type restricted __le32
drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: right side has type int
Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
Changes in v2: use a local var to collect flags
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 09b469243d73..bec8c1948fa0 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -2275,6 +2275,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
struct lu_fid master_fid = op_data->op_fid1;
struct obd_device *obd = exp->exp_obd;
__u64 hash_offset = offset;
+ __u32 ldp_flags;
struct page *min_ent_page = NULL;
struct page *ent_page = NULL;
struct lu_dirent *min_ent = NULL;
@@ -2302,7 +2303,7 @@ static int lmv_read_striped_page(struct obd_export *exp,
dp = kmap(ent_page);
memset(dp, 0, sizeof(*dp));
dp->ldp_hash_start = cpu_to_le64(offset);
- dp->ldp_flags |= LDF_COLLIDE;
+ ldp_flags = LDF_COLLIDE;
area = dp + 1;
left_bytes = PAGE_SIZE - sizeof(*dp);
@@ -2380,8 +2381,8 @@ static int lmv_read_striped_page(struct obd_export *exp,
ent_page = NULL;
} else {
if (ent == area)
- dp->ldp_flags |= LDF_EMPTY;
- dp->ldp_flags = cpu_to_le32(dp->ldp_flags);
+ ldp_flags |= LDF_EMPTY;
+ dp->ldp_flags |= cpu_to_le32(ldp_flags);
dp->ldp_hash_end = cpu_to_le64(hash_offset);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-05 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29 15:49 [PATCH] staging: lustre: fix sparse warnings on assignment Valentin Vidic
2017-05-05 5:27 ` [PATCH v2] staging: lustre: cleanup le32 assignment to ldp_flags Valentin Vidic
2017-05-05 5:27 ` [lustre-devel] " Valentin Vidic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.