UBI: fix sparse warnings
Fix "symbol shadows an earlier one" warnings. Although they are harmless but it does not hurt to fix them and make sparse happy. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
parent
dcec4c3bdc
commit
8bc2296196
2 changed files with 45 additions and 41 deletions
|
@ -266,7 +266,7 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
void *buf;
|
void *buf;
|
||||||
int len, err, second_is_newer, bitflips = 0, corrupted = 0;
|
int len, err, second_is_newer, bitflips = 0, corrupted = 0;
|
||||||
uint32_t data_crc, crc;
|
uint32_t data_crc, crc;
|
||||||
struct ubi_vid_hdr *vidh = NULL;
|
struct ubi_vid_hdr *vh = NULL;
|
||||||
unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum);
|
unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum);
|
||||||
|
|
||||||
if (seb->sqnum == 0 && sqnum2 == 0) {
|
if (seb->sqnum == 0 && sqnum2 == 0) {
|
||||||
|
@ -323,11 +323,11 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
} else {
|
} else {
|
||||||
pnum = seb->pnum;
|
pnum = seb->pnum;
|
||||||
|
|
||||||
vidh = ubi_zalloc_vid_hdr(ubi);
|
vh = ubi_zalloc_vid_hdr(ubi);
|
||||||
if (!vidh)
|
if (!vh)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
err = ubi_io_read_vid_hdr(ubi, pnum, vidh, 0);
|
err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err == UBI_IO_BITFLIPS)
|
if (err == UBI_IO_BITFLIPS)
|
||||||
bitflips = 1;
|
bitflips = 1;
|
||||||
|
@ -341,7 +341,7 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vidh->copy_flag) {
|
if (!vh->copy_flag) {
|
||||||
/* It is not a copy, so it is newer */
|
/* It is not a copy, so it is newer */
|
||||||
dbg_bld("first PEB %d is newer, copy_flag is unset",
|
dbg_bld("first PEB %d is newer, copy_flag is unset",
|
||||||
pnum);
|
pnum);
|
||||||
|
@ -349,7 +349,7 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
goto out_free_vidh;
|
goto out_free_vidh;
|
||||||
}
|
}
|
||||||
|
|
||||||
vid_hdr = vidh;
|
vid_hdr = vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the data of the copy and check the CRC */
|
/* Read the data of the copy and check the CRC */
|
||||||
|
@ -379,7 +379,7 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
}
|
}
|
||||||
|
|
||||||
vfree(buf);
|
vfree(buf);
|
||||||
ubi_free_vid_hdr(ubi, vidh);
|
ubi_free_vid_hdr(ubi, vh);
|
||||||
|
|
||||||
if (second_is_newer)
|
if (second_is_newer)
|
||||||
dbg_bld("second PEB %d is newer, copy_flag is set", pnum);
|
dbg_bld("second PEB %d is newer, copy_flag is set", pnum);
|
||||||
|
@ -391,7 +391,7 @@ static int compare_lebs(const struct ubi_device *ubi,
|
||||||
out_free_buf:
|
out_free_buf:
|
||||||
vfree(buf);
|
vfree(buf);
|
||||||
out_free_vidh:
|
out_free_vidh:
|
||||||
ubi_free_vid_hdr(ubi, vidh);
|
ubi_free_vid_hdr(ubi, vh);
|
||||||
ubi_assert(err < 0);
|
ubi_assert(err < 0);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,21 +37,21 @@ static ssize_t vol_attribute_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf);
|
struct device_attribute *attr, char *buf);
|
||||||
|
|
||||||
/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */
|
/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */
|
||||||
static struct device_attribute vol_reserved_ebs =
|
static struct device_attribute attr_vol_reserved_ebs =
|
||||||
__ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_type =
|
static struct device_attribute attr_vol_type =
|
||||||
__ATTR(type, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(type, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_name =
|
static struct device_attribute attr_vol_name =
|
||||||
__ATTR(name, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(name, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_corrupted =
|
static struct device_attribute attr_vol_corrupted =
|
||||||
__ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_alignment =
|
static struct device_attribute attr_vol_alignment =
|
||||||
__ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_usable_eb_size =
|
static struct device_attribute attr_vol_usable_eb_size =
|
||||||
__ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_data_bytes =
|
static struct device_attribute attr_vol_data_bytes =
|
||||||
__ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL);
|
||||||
static struct device_attribute vol_upd_marker =
|
static struct device_attribute attr_vol_upd_marker =
|
||||||
__ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL);
|
__ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,23 +78,27 @@ static ssize_t vol_attribute_show(struct device *dev,
|
||||||
spin_unlock(&vol->ubi->volumes_lock);
|
spin_unlock(&vol->ubi->volumes_lock);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (attr == &vol_reserved_ebs)
|
if (attr == &attr_vol_reserved_ebs)
|
||||||
ret = sprintf(buf, "%d\n", vol->reserved_pebs);
|
ret = sprintf(buf, "%d\n", vol->reserved_pebs);
|
||||||
else if (attr == &vol_type) {
|
else if (attr == &attr_vol_type) {
|
||||||
const char *tp;
|
const char *tp;
|
||||||
tp = vol->vol_type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static";
|
|
||||||
|
if (vol->vol_type == UBI_DYNAMIC_VOLUME)
|
||||||
|
tp = "dynamic";
|
||||||
|
else
|
||||||
|
tp = "static";
|
||||||
ret = sprintf(buf, "%s\n", tp);
|
ret = sprintf(buf, "%s\n", tp);
|
||||||
} else if (attr == &vol_name)
|
} else if (attr == &attr_vol_name)
|
||||||
ret = sprintf(buf, "%s\n", vol->name);
|
ret = sprintf(buf, "%s\n", vol->name);
|
||||||
else if (attr == &vol_corrupted)
|
else if (attr == &attr_vol_corrupted)
|
||||||
ret = sprintf(buf, "%d\n", vol->corrupted);
|
ret = sprintf(buf, "%d\n", vol->corrupted);
|
||||||
else if (attr == &vol_alignment)
|
else if (attr == &attr_vol_alignment)
|
||||||
ret = sprintf(buf, "%d\n", vol->alignment);
|
ret = sprintf(buf, "%d\n", vol->alignment);
|
||||||
else if (attr == &vol_usable_eb_size) {
|
else if (attr == &attr_vol_usable_eb_size) {
|
||||||
ret = sprintf(buf, "%d\n", vol->usable_leb_size);
|
ret = sprintf(buf, "%d\n", vol->usable_leb_size);
|
||||||
} else if (attr == &vol_data_bytes)
|
} else if (attr == &attr_vol_data_bytes)
|
||||||
ret = sprintf(buf, "%lld\n", vol->used_bytes);
|
ret = sprintf(buf, "%lld\n", vol->used_bytes);
|
||||||
else if (attr == &vol_upd_marker)
|
else if (attr == &attr_vol_upd_marker)
|
||||||
ret = sprintf(buf, "%d\n", vol->upd_marker);
|
ret = sprintf(buf, "%d\n", vol->upd_marker);
|
||||||
else
|
else
|
||||||
BUG();
|
BUG();
|
||||||
|
@ -126,28 +130,28 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = device_create_file(&vol->dev, &vol_reserved_ebs);
|
err = device_create_file(&vol->dev, &attr_vol_reserved_ebs);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_type);
|
err = device_create_file(&vol->dev, &attr_vol_type);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_name);
|
err = device_create_file(&vol->dev, &attr_vol_name);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_corrupted);
|
err = device_create_file(&vol->dev, &attr_vol_corrupted);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_alignment);
|
err = device_create_file(&vol->dev, &attr_vol_alignment);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_usable_eb_size);
|
err = device_create_file(&vol->dev, &attr_vol_usable_eb_size);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_data_bytes);
|
err = device_create_file(&vol->dev, &attr_vol_data_bytes);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = device_create_file(&vol->dev, &vol_upd_marker);
|
err = device_create_file(&vol->dev, &attr_vol_upd_marker);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -159,14 +163,14 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
|
||||||
*/
|
*/
|
||||||
static void volume_sysfs_close(struct ubi_volume *vol)
|
static void volume_sysfs_close(struct ubi_volume *vol)
|
||||||
{
|
{
|
||||||
device_remove_file(&vol->dev, &vol_upd_marker);
|
device_remove_file(&vol->dev, &attr_vol_upd_marker);
|
||||||
device_remove_file(&vol->dev, &vol_data_bytes);
|
device_remove_file(&vol->dev, &attr_vol_data_bytes);
|
||||||
device_remove_file(&vol->dev, &vol_usable_eb_size);
|
device_remove_file(&vol->dev, &attr_vol_usable_eb_size);
|
||||||
device_remove_file(&vol->dev, &vol_alignment);
|
device_remove_file(&vol->dev, &attr_vol_alignment);
|
||||||
device_remove_file(&vol->dev, &vol_corrupted);
|
device_remove_file(&vol->dev, &attr_vol_corrupted);
|
||||||
device_remove_file(&vol->dev, &vol_name);
|
device_remove_file(&vol->dev, &attr_vol_name);
|
||||||
device_remove_file(&vol->dev, &vol_type);
|
device_remove_file(&vol->dev, &attr_vol_type);
|
||||||
device_remove_file(&vol->dev, &vol_reserved_ebs);
|
device_remove_file(&vol->dev, &attr_vol_reserved_ebs);
|
||||||
device_unregister(&vol->dev);
|
device_unregister(&vol->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue