aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-22 08:25:02 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:20 -0400
commit8bc22961966b845aa5f965be30771902146c2fcc (patch)
treebfa7236da8184560f85fdeb2ad4d565995e237ac
parentdcec4c3bdc4d5f4bd2d858ee1ce11e3424cbaed7 (diff)
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>
-rw-r--r--drivers/mtd/ubi/scan.c16
-rw-r--r--drivers/mtd/ubi/vmt.c70
2 files changed, 45 insertions, 41 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 80c73d88c83f..18c347b24e27 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -266,7 +266,7 @@ static int compare_lebs(const struct ubi_device *ubi,
266 void *buf; 266 void *buf;
267 int len, err, second_is_newer, bitflips = 0, corrupted = 0; 267 int len, err, second_is_newer, bitflips = 0, corrupted = 0;
268 uint32_t data_crc, crc; 268 uint32_t data_crc, crc;
269 struct ubi_vid_hdr *vidh = NULL; 269 struct ubi_vid_hdr *vh = NULL;
270 unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum); 270 unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum);
271 271
272 if (seb->sqnum == 0 && sqnum2 == 0) { 272 if (seb->sqnum == 0 && sqnum2 == 0) {
@@ -323,11 +323,11 @@ static int compare_lebs(const struct ubi_device *ubi,
323 } else { 323 } else {
324 pnum = seb->pnum; 324 pnum = seb->pnum;
325 325
326 vidh = ubi_zalloc_vid_hdr(ubi); 326 vh = ubi_zalloc_vid_hdr(ubi);
327 if (!vidh) 327 if (!vh)
328 return -ENOMEM; 328 return -ENOMEM;
329 329
330 err = ubi_io_read_vid_hdr(ubi, pnum, vidh, 0); 330 err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
331 if (err) { 331 if (err) {
332 if (err == UBI_IO_BITFLIPS) 332 if (err == UBI_IO_BITFLIPS)
333 bitflips = 1; 333 bitflips = 1;
@@ -341,7 +341,7 @@ static int compare_lebs(const struct ubi_device *ubi,
341 } 341 }
342 } 342 }
343 343
344 if (!vidh->copy_flag) { 344 if (!vh->copy_flag) {
345 /* It is not a copy, so it is newer */ 345 /* It is not a copy, so it is newer */
346 dbg_bld("first PEB %d is newer, copy_flag is unset", 346 dbg_bld("first PEB %d is newer, copy_flag is unset",
347 pnum); 347 pnum);
@@ -349,7 +349,7 @@ static int compare_lebs(const struct ubi_device *ubi,
349 goto out_free_vidh; 349 goto out_free_vidh;
350 } 350 }
351 351
352 vid_hdr = vidh; 352 vid_hdr = vh;
353 } 353 }
354 354
355 /* Read the data of the copy and check the CRC */ 355 /* Read the data of the copy and check the CRC */
@@ -379,7 +379,7 @@ static int compare_lebs(const struct ubi_device *ubi,
379 } 379 }
380 380
381 vfree(buf); 381 vfree(buf);
382 ubi_free_vid_hdr(ubi, vidh); 382 ubi_free_vid_hdr(ubi, vh);
383 383
384 if (second_is_newer) 384 if (second_is_newer)
385 dbg_bld("second PEB %d is newer, copy_flag is set", pnum); 385 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,
391out_free_buf: 391out_free_buf:
392 vfree(buf); 392 vfree(buf);
393out_free_vidh: 393out_free_vidh:
394 ubi_free_vid_hdr(ubi, vidh); 394 ubi_free_vid_hdr(ubi, vh);
395 ubi_assert(err < 0); 395 ubi_assert(err < 0);
396 return err; 396 return err;
397} 397}
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index ea0d5c825ab4..88629a320c2b 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -37,21 +37,21 @@ static ssize_t vol_attribute_show(struct device *dev,
37 struct device_attribute *attr, char *buf); 37 struct device_attribute *attr, char *buf);
38 38
39/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */ 39/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */
40static struct device_attribute vol_reserved_ebs = 40static struct device_attribute attr_vol_reserved_ebs =
41 __ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL); 41 __ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL);
42static struct device_attribute vol_type = 42static struct device_attribute attr_vol_type =
43 __ATTR(type, S_IRUGO, vol_attribute_show, NULL); 43 __ATTR(type, S_IRUGO, vol_attribute_show, NULL);
44static struct device_attribute vol_name = 44static struct device_attribute attr_vol_name =
45 __ATTR(name, S_IRUGO, vol_attribute_show, NULL); 45 __ATTR(name, S_IRUGO, vol_attribute_show, NULL);
46static struct device_attribute vol_corrupted = 46static struct device_attribute attr_vol_corrupted =
47 __ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL); 47 __ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL);
48static struct device_attribute vol_alignment = 48static struct device_attribute attr_vol_alignment =
49 __ATTR(alignment, S_IRUGO, vol_attribute_show, NULL); 49 __ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
50static struct device_attribute vol_usable_eb_size = 50static struct device_attribute attr_vol_usable_eb_size =
51 __ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL); 51 __ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL);
52static struct device_attribute vol_data_bytes = 52static struct device_attribute attr_vol_data_bytes =
53 __ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL); 53 __ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL);
54static struct device_attribute vol_upd_marker = 54static struct device_attribute attr_vol_upd_marker =
55 __ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL); 55 __ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL);
56 56
57/* 57/*
@@ -78,23 +78,27 @@ static ssize_t vol_attribute_show(struct device *dev,
78 spin_unlock(&vol->ubi->volumes_lock); 78 spin_unlock(&vol->ubi->volumes_lock);
79 return -ENODEV; 79 return -ENODEV;
80 } 80 }
81 if (attr == &vol_reserved_ebs) 81 if (attr == &attr_vol_reserved_ebs)
82 ret = sprintf(buf, "%d\n", vol->reserved_pebs); 82 ret = sprintf(buf, "%d\n", vol->reserved_pebs);
83 else if (attr == &vol_type) { 83 else if (attr == &attr_vol_type) {
84 const char *tp; 84 const char *tp;
85 tp = vol->vol_type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static"; 85
86 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
87 tp = "dynamic";
88 else
89 tp = "static";
86 ret = sprintf(buf, "%s\n", tp); 90 ret = sprintf(buf, "%s\n", tp);
87 } else if (attr == &vol_name) 91 } else if (attr == &attr_vol_name)
88 ret = sprintf(buf, "%s\n", vol->name); 92 ret = sprintf(buf, "%s\n", vol->name);
89 else if (attr == &vol_corrupted) 93 else if (attr == &attr_vol_corrupted)
90 ret = sprintf(buf, "%d\n", vol->corrupted); 94 ret = sprintf(buf, "%d\n", vol->corrupted);
91 else if (attr == &vol_alignment) 95 else if (attr == &attr_vol_alignment)
92 ret = sprintf(buf, "%d\n", vol->alignment); 96 ret = sprintf(buf, "%d\n", vol->alignment);
93 else if (attr == &vol_usable_eb_size) { 97 else if (attr == &attr_vol_usable_eb_size) {
94 ret = sprintf(buf, "%d\n", vol->usable_leb_size); 98 ret = sprintf(buf, "%d\n", vol->usable_leb_size);
95 } else if (attr == &vol_data_bytes) 99 } else if (attr == &attr_vol_data_bytes)
96 ret = sprintf(buf, "%lld\n", vol->used_bytes); 100 ret = sprintf(buf, "%lld\n", vol->used_bytes);
97 else if (attr == &vol_upd_marker) 101 else if (attr == &attr_vol_upd_marker)
98 ret = sprintf(buf, "%d\n", vol->upd_marker); 102 ret = sprintf(buf, "%d\n", vol->upd_marker);
99 else 103 else
100 BUG(); 104 BUG();
@@ -126,28 +130,28 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
126{ 130{
127 int err; 131 int err;
128 132
129 err = device_create_file(&vol->dev, &vol_reserved_ebs); 133 err = device_create_file(&vol->dev, &attr_vol_reserved_ebs);
130 if (err) 134 if (err)
131 return err; 135 return err;
132 err = device_create_file(&vol->dev, &vol_type); 136 err = device_create_file(&vol->dev, &attr_vol_type);
133 if (err) 137 if (err)
134 return err; 138 return err;
135 err = device_create_file(&vol->dev, &vol_name); 139 err = device_create_file(&vol->dev, &attr_vol_name);
136 if (err) 140 if (err)
137 return err; 141 return err;
138 err = device_create_file(&vol->dev, &vol_corrupted); 142 err = device_create_file(&vol->dev, &attr_vol_corrupted);
139 if (err) 143 if (err)
140 return err; 144 return err;
141 err = device_create_file(&vol->dev, &vol_alignment); 145 err = device_create_file(&vol->dev, &attr_vol_alignment);
142 if (err) 146 if (err)
143 return err; 147 return err;
144 err = device_create_file(&vol->dev, &vol_usable_eb_size); 148 err = device_create_file(&vol->dev, &attr_vol_usable_eb_size);
145 if (err) 149 if (err)
146 return err; 150 return err;
147 err = device_create_file(&vol->dev, &vol_data_bytes); 151 err = device_create_file(&vol->dev, &attr_vol_data_bytes);
148 if (err) 152 if (err)
149 return err; 153 return err;
150 err = device_create_file(&vol->dev, &vol_upd_marker); 154 err = device_create_file(&vol->dev, &attr_vol_upd_marker);
151 if (err) 155 if (err)
152 return err; 156 return err;
153 return 0; 157 return 0;
@@ -159,14 +163,14 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
159 */ 163 */
160static void volume_sysfs_close(struct ubi_volume *vol) 164static void volume_sysfs_close(struct ubi_volume *vol)
161{ 165{
162 device_remove_file(&vol->dev, &vol_upd_marker); 166 device_remove_file(&vol->dev, &attr_vol_upd_marker);
163 device_remove_file(&vol->dev, &vol_data_bytes); 167 device_remove_file(&vol->dev, &attr_vol_data_bytes);
164 device_remove_file(&vol->dev, &vol_usable_eb_size); 168 device_remove_file(&vol->dev, &attr_vol_usable_eb_size);
165 device_remove_file(&vol->dev, &vol_alignment); 169 device_remove_file(&vol->dev, &attr_vol_alignment);
166 device_remove_file(&vol->dev, &vol_corrupted); 170 device_remove_file(&vol->dev, &attr_vol_corrupted);
167 device_remove_file(&vol->dev, &vol_name); 171 device_remove_file(&vol->dev, &attr_vol_name);
168 device_remove_file(&vol->dev, &vol_type); 172 device_remove_file(&vol->dev, &attr_vol_type);
169 device_remove_file(&vol->dev, &vol_reserved_ebs); 173 device_remove_file(&vol->dev, &attr_vol_reserved_ebs);
170 device_unregister(&vol->dev); 174 device_unregister(&vol->dev);
171} 175}
172 176