Skip to content

Commit

Permalink
libnvdimm, label: Fix sparse warning
Browse files Browse the repository at this point in the history
The kbuild robot reports:

drivers/nvdimm/label.c:500:32: warning: restricted __le32 degrades to integer

...read 'nslot' into a local u32.

Reported-by: kbuild test robot <[email protected]>
Acked-by: Alexander Duyck <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
djbw committed Oct 12, 2018
1 parent 7d47aad commit 97052c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/nvdimm/label.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)
struct nd_namespace_index *nsindex;
unsigned int i;
int rc = 0;
u32 nslot;

if (ndd->data)
return 0;
Expand Down Expand Up @@ -495,9 +496,10 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)

/* Determine starting offset for label data */
offset = __le64_to_cpu(nsindex->labeloff);
nslot = __le32_to_cpu(nsindex->nslot);

/* Loop through the free list pulling in any active labels */
for (i = 0; i < nsindex->nslot; i++, offset += ndd->nslabel_size) {
for (i = 0; i < nslot; i++, offset += ndd->nslabel_size) {
size_t label_read_size;

/* zero out the unused labels */
Expand Down

0 comments on commit 97052c1

Please sign in to comment.