aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-24 14:51:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-24 14:51:26 -0400
commit4d429480352c63db2228489f0db9fd381cdc3c9c (patch)
tree96a3bc976735ef01d5d5e42353ae1dd795d34370 /drivers/mtd
parenteb08d8ff476ad39a149e1044c7d3fd742a168864 (diff)
parentab50ff684707031ed4bad2fdd313208ae392e5bb (diff)
Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6: UBI: switch to dynamic printks UBI: turn some macros into static inline UBI: improve checking in debugging prints UBI: fix typo in a message UBI: fix minor stylistic issues UBI: use __packed instead of __attribute__((packed)) UBI: cleanup comments around volume properties UBI: re-name set volume properties ioctl UBI: make the control character device non-seekable
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/cdev.c14
-rw-r--r--drivers/mtd/ubi/debug.c21
-rw-r--r--drivers/mtd/ubi/debug.h161
-rw-r--r--drivers/mtd/ubi/io.c6
-rw-r--r--drivers/mtd/ubi/scan.c2
-rw-r--r--drivers/mtd/ubi/ubi-media.h6
-rw-r--r--drivers/mtd/ubi/ubi.h4
-rw-r--r--drivers/mtd/ubi/wl.c3
8 files changed, 109 insertions, 108 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index af9fb0ff8210..191f3bb3c41a 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -115,7 +115,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
115 mode = UBI_READONLY; 115 mode = UBI_READONLY;
116 116
117 dbg_gen("open device %d, volume %d, mode %d", 117 dbg_gen("open device %d, volume %d, mode %d",
118 ubi_num, vol_id, mode); 118 ubi_num, vol_id, mode);
119 119
120 desc = ubi_open_volume(ubi_num, vol_id, mode); 120 desc = ubi_open_volume(ubi_num, vol_id, mode);
121 if (IS_ERR(desc)) 121 if (IS_ERR(desc))
@@ -158,7 +158,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
158 loff_t new_offset; 158 loff_t new_offset;
159 159
160 if (vol->updating) { 160 if (vol->updating) {
161 /* Update is in progress, seeking is prohibited */ 161 /* Update is in progress, seeking is prohibited */
162 dbg_err("updating"); 162 dbg_err("updating");
163 return -EBUSY; 163 return -EBUSY;
164 } 164 }
@@ -561,18 +561,18 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
561 } 561 }
562 562
563 /* Set volume property command */ 563 /* Set volume property command */
564 case UBI_IOCSETPROP: 564 case UBI_IOCSETVOLPROP:
565 { 565 {
566 struct ubi_set_prop_req req; 566 struct ubi_set_vol_prop_req req;
567 567
568 err = copy_from_user(&req, argp, 568 err = copy_from_user(&req, argp,
569 sizeof(struct ubi_set_prop_req)); 569 sizeof(struct ubi_set_vol_prop_req));
570 if (err) { 570 if (err) {
571 err = -EFAULT; 571 err = -EFAULT;
572 break; 572 break;
573 } 573 }
574 switch (req.property) { 574 switch (req.property) {
575 case UBI_PROP_DIRECT_WRITE: 575 case UBI_VOL_PROP_DIRECT_WRITE:
576 mutex_lock(&ubi->device_mutex); 576 mutex_lock(&ubi->device_mutex);
577 desc->vol->direct_writes = !!req.value; 577 desc->vol->direct_writes = !!req.value;
578 mutex_unlock(&ubi->device_mutex); 578 mutex_unlock(&ubi->device_mutex);
@@ -1100,5 +1100,5 @@ const struct file_operations ubi_ctrl_cdev_operations = {
1100 .owner = THIS_MODULE, 1100 .owner = THIS_MODULE,
1101 .unlocked_ioctl = ctrl_cdev_ioctl, 1101 .unlocked_ioctl = ctrl_cdev_ioctl,
1102 .compat_ioctl = ctrl_cdev_compat_ioctl, 1102 .compat_ioctl = ctrl_cdev_compat_ioctl,
1103 .llseek = noop_llseek, 1103 .llseek = no_llseek,
1104}; 1104};
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index d4d07e5f138f..2224cbe41ddf 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -30,15 +30,12 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
32 32
33unsigned int ubi_msg_flags;
34unsigned int ubi_chk_flags; 33unsigned int ubi_chk_flags;
35unsigned int ubi_tst_flags; 34unsigned int ubi_tst_flags;
36 35
37module_param_named(debug_msgs, ubi_msg_flags, uint, S_IRUGO | S_IWUSR);
38module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); 36module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR);
39module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); 37module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR);
40 38
41MODULE_PARM_DESC(debug_msgs, "Debug message type flags");
42MODULE_PARM_DESC(debug_chks, "Debug check flags"); 39MODULE_PARM_DESC(debug_chks, "Debug check flags");
43MODULE_PARM_DESC(debug_tsts, "Debug special test flags"); 40MODULE_PARM_DESC(debug_tsts, "Debug special test flags");
44 41
@@ -75,15 +72,15 @@ void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr)
75{ 72{
76 printk(KERN_DEBUG "Volume identifier header dump:\n"); 73 printk(KERN_DEBUG "Volume identifier header dump:\n");
77 printk(KERN_DEBUG "\tmagic %08x\n", be32_to_cpu(vid_hdr->magic)); 74 printk(KERN_DEBUG "\tmagic %08x\n", be32_to_cpu(vid_hdr->magic));
78 printk(KERN_DEBUG "\tversion %d\n", (int)vid_hdr->version); 75 printk(KERN_DEBUG "\tversion %d\n", (int)vid_hdr->version);
79 printk(KERN_DEBUG "\tvol_type %d\n", (int)vid_hdr->vol_type); 76 printk(KERN_DEBUG "\tvol_type %d\n", (int)vid_hdr->vol_type);
80 printk(KERN_DEBUG "\tcopy_flag %d\n", (int)vid_hdr->copy_flag); 77 printk(KERN_DEBUG "\tcopy_flag %d\n", (int)vid_hdr->copy_flag);
81 printk(KERN_DEBUG "\tcompat %d\n", (int)vid_hdr->compat); 78 printk(KERN_DEBUG "\tcompat %d\n", (int)vid_hdr->compat);
82 printk(KERN_DEBUG "\tvol_id %d\n", be32_to_cpu(vid_hdr->vol_id)); 79 printk(KERN_DEBUG "\tvol_id %d\n", be32_to_cpu(vid_hdr->vol_id));
83 printk(KERN_DEBUG "\tlnum %d\n", be32_to_cpu(vid_hdr->lnum)); 80 printk(KERN_DEBUG "\tlnum %d\n", be32_to_cpu(vid_hdr->lnum));
84 printk(KERN_DEBUG "\tdata_size %d\n", be32_to_cpu(vid_hdr->data_size)); 81 printk(KERN_DEBUG "\tdata_size %d\n", be32_to_cpu(vid_hdr->data_size));
85 printk(KERN_DEBUG "\tused_ebs %d\n", be32_to_cpu(vid_hdr->used_ebs)); 82 printk(KERN_DEBUG "\tused_ebs %d\n", be32_to_cpu(vid_hdr->used_ebs));
86 printk(KERN_DEBUG "\tdata_pad %d\n", be32_to_cpu(vid_hdr->data_pad)); 83 printk(KERN_DEBUG "\tdata_pad %d\n", be32_to_cpu(vid_hdr->data_pad));
87 printk(KERN_DEBUG "\tsqnum %llu\n", 84 printk(KERN_DEBUG "\tsqnum %llu\n",
88 (unsigned long long)be64_to_cpu(vid_hdr->sqnum)); 85 (unsigned long long)be64_to_cpu(vid_hdr->sqnum));
89 printk(KERN_DEBUG "\thdr_crc %08x\n", be32_to_cpu(vid_hdr->hdr_crc)); 86 printk(KERN_DEBUG "\thdr_crc %08x\n", be32_to_cpu(vid_hdr->hdr_crc));
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 0b0c2888c656..3f1a09c5c438 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -21,11 +21,17 @@
21#ifndef __UBI_DEBUG_H__ 21#ifndef __UBI_DEBUG_H__
22#define __UBI_DEBUG_H__ 22#define __UBI_DEBUG_H__
23 23
24struct ubi_ec_hdr;
25struct ubi_vid_hdr;
26struct ubi_volume;
27struct ubi_vtbl_record;
28struct ubi_scan_volume;
29struct ubi_scan_leb;
30struct ubi_mkvol_req;
31
24#ifdef CONFIG_MTD_UBI_DEBUG 32#ifdef CONFIG_MTD_UBI_DEBUG
25#include <linux/random.h> 33#include <linux/random.h>
26 34
27#define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__)
28
29#define ubi_assert(expr) do { \ 35#define ubi_assert(expr) do { \
30 if (unlikely(!(expr))) { \ 36 if (unlikely(!(expr))) { \
31 printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ 37 printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \
@@ -34,24 +40,28 @@
34 } \ 40 } \
35} while (0) 41} while (0)
36 42
37#define dbg_msg(fmt, ...) \ 43#define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__)
38 printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \
39 current->pid, __func__, ##__VA_ARGS__)
40
41#define dbg_do_msg(typ, fmt, ...) do { \
42 if (ubi_msg_flags & typ) \
43 dbg_msg(fmt, ##__VA_ARGS__); \
44} while (0)
45 44
46#define ubi_dbg_dump_stack() dump_stack() 45#define ubi_dbg_dump_stack() dump_stack()
47 46
48struct ubi_ec_hdr; 47#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \
49struct ubi_vid_hdr; 48 print_hex_dump(l, ps, pt, r, g, b, len, a)
50struct ubi_volume; 49
51struct ubi_vtbl_record; 50#define ubi_dbg_msg(type, fmt, ...) \
52struct ubi_scan_volume; 51 pr_debug("UBI DBG " type ": " fmt "\n", ##__VA_ARGS__)
53struct ubi_scan_leb; 52
54struct ubi_mkvol_req; 53/* Just a debugging messages not related to any specific UBI subsystem */
54#define dbg_msg(fmt, ...) ubi_dbg_msg("msg", fmt, ##__VA_ARGS__)
55/* General debugging messages */
56#define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__)
57/* Messages from the eraseblock association sub-system */
58#define dbg_eba(fmt, ...) ubi_dbg_msg("eba", fmt, ##__VA_ARGS__)
59/* Messages from the wear-leveling sub-system */
60#define dbg_wl(fmt, ...) ubi_dbg_msg("wl", fmt, ##__VA_ARGS__)
61/* Messages from the input/output sub-system */
62#define dbg_io(fmt, ...) ubi_dbg_msg("io", fmt, ##__VA_ARGS__)
63/* Initialization and build messages */
64#define dbg_bld(fmt, ...) ubi_dbg_msg("bld", fmt, ##__VA_ARGS__)
55 65
56void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); 66void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr);
57void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); 67void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
@@ -62,43 +72,6 @@ void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
62void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); 72void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
63void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); 73void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
64 74
65extern unsigned int ubi_msg_flags;
66
67/*
68 * Debugging message type flags (must match msg_type_names in debug.c).
69 *
70 * UBI_MSG_GEN: general messages
71 * UBI_MSG_EBA: journal messages
72 * UBI_MSG_WL: mount messages
73 * UBI_MSG_IO: commit messages
74 * UBI_MSG_BLD: LEB find messages
75 */
76enum {
77 UBI_MSG_GEN = 0x1,
78 UBI_MSG_EBA = 0x2,
79 UBI_MSG_WL = 0x4,
80 UBI_MSG_IO = 0x8,
81 UBI_MSG_BLD = 0x10,
82};
83
84#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \
85 print_hex_dump(l, ps, pt, r, g, b, len, a)
86
87/* General debugging messages */
88#define dbg_gen(fmt, ...) dbg_do_msg(UBI_MSG_GEN, fmt, ##__VA_ARGS__)
89
90/* Messages from the eraseblock association sub-system */
91#define dbg_eba(fmt, ...) dbg_do_msg(UBI_MSG_EBA, fmt, ##__VA_ARGS__)
92
93/* Messages from the wear-leveling sub-system */
94#define dbg_wl(fmt, ...) dbg_do_msg(UBI_MSG_WL, fmt, ##__VA_ARGS__)
95
96/* Messages from the input/output sub-system */
97#define dbg_io(fmt, ...) dbg_do_msg(UBI_MSG_IO, fmt, ##__VA_ARGS__)
98
99/* Initialization and build messages */
100#define dbg_bld(fmt, ...) dbg_do_msg(UBI_MSG_BLD, fmt, ##__VA_ARGS__)
101
102extern unsigned int ubi_chk_flags; 75extern unsigned int ubi_chk_flags;
103 76
104/* 77/*
@@ -184,31 +157,61 @@ static inline int ubi_dbg_is_erase_failure(void)
184 157
185#else 158#else
186 159
187#define ubi_assert(expr) ({}) 160/* Use "if (0)" to make compiler check arguments even if debugging is off */
188#define dbg_err(fmt, ...) ({}) 161#define ubi_assert(expr) do { \
189#define dbg_msg(fmt, ...) ({}) 162 if (0) { \
190#define dbg_gen(fmt, ...) ({}) 163 printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \
191#define dbg_eba(fmt, ...) ({}) 164 __func__, __LINE__, current->pid); \
192#define dbg_wl(fmt, ...) ({}) 165 } \
193#define dbg_io(fmt, ...) ({}) 166} while (0)
194#define dbg_bld(fmt, ...) ({}) 167
195#define ubi_dbg_dump_stack() ({}) 168#define dbg_err(fmt, ...) do { \
196#define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) 169 if (0) \
197#define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) 170 ubi_err(fmt, ##__VA_ARGS__); \
198#define ubi_dbg_dump_vol_info(vol) ({}) 171} while (0)
199#define ubi_dbg_dump_vtbl_record(r, idx) ({}) 172
200#define ubi_dbg_dump_sv(sv) ({}) 173#define ubi_dbg_msg(fmt, ...) do { \
201#define ubi_dbg_dump_seb(seb, type) ({}) 174 if (0) \
202#define ubi_dbg_dump_mkvol_req(req) ({}) 175 pr_debug(fmt "\n", ##__VA_ARGS__); \
203#define ubi_dbg_dump_flash(ubi, pnum, offset, len) ({}) 176} while (0)
204#define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) ({}) 177
205 178#define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
206#define ubi_dbg_is_bgt_disabled() 0 179#define dbg_gen(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
207#define ubi_dbg_is_bitflip() 0 180#define dbg_eba(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
208#define ubi_dbg_is_write_failure() 0 181#define dbg_wl(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
209#define ubi_dbg_is_erase_failure() 0 182#define dbg_io(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
210#define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 183#define dbg_bld(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
211#define ubi_dbg_check_write(ubi, buf, pnum, offset, len) 0 184
185static inline void ubi_dbg_dump_stack(void) { return; }
186static inline void
187ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) { return; }
188static inline void
189ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr) { return; }
190static inline void
191ubi_dbg_dump_vol_info(const struct ubi_volume *vol) { return; }
192static inline void
193ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) { return; }
194static inline void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv) { return; }
195static inline void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb,
196 int type) { return; }
197static inline void
198ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req) { return; }
199static inline void ubi_dbg_dump_flash(struct ubi_device *ubi,
200 int pnum, int offset, int len) { return; }
201static inline void
202ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r,
203 int g, const void *b, size_t len, bool a) { return; }
204
205static inline int ubi_dbg_is_bgt_disabled(void) { return 0; }
206static inline int ubi_dbg_is_bitflip(void) { return 0; }
207static inline int ubi_dbg_is_write_failure(void) { return 0; }
208static inline int ubi_dbg_is_erase_failure(void) { return 0; }
209static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi,
210 int pnum, int offset,
211 int len) { return 0; }
212static inline int ubi_dbg_check_write(struct ubi_device *ubi,
213 const void *buf, int pnum,
214 int offset, int len) { return 0; }
212 215
213#endif /* !CONFIG_MTD_UBI_DEBUG */ 216#endif /* !CONFIG_MTD_UBI_DEBUG */
214#endif /* !__UBI_DEBUG_H__ */ 217#endif /* !__UBI_DEBUG_H__ */
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index e347cc4388ed..8c1b1c7bc4a7 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -189,8 +189,8 @@ retry:
189 } 189 }
190 190
191 if (retries++ < UBI_IO_RETRIES) { 191 if (retries++ < UBI_IO_RETRIES) {
192 dbg_io("error %d%s while reading %d bytes from PEB %d:%d," 192 dbg_io("error %d%s while reading %d bytes from PEB "
193 " read only %zd bytes, retry", 193 "%d:%d, read only %zd bytes, retry",
194 err, errstr, len, pnum, offset, read); 194 err, errstr, len, pnum, offset, read);
195 yield(); 195 yield();
196 goto retry; 196 goto retry;
@@ -465,7 +465,7 @@ static int torture_peb(struct ubi_device *ubi, int pnum)
465 } 465 }
466 466
467 err = patt_count; 467 err = patt_count;
468 ubi_msg("PEB %d passed torture test, do not mark it a bad", pnum); 468 ubi_msg("PEB %d passed torture test, do not mark it as bad", pnum);
469 469
470out: 470out:
471 mutex_unlock(&ubi->buf_mutex); 471 mutex_unlock(&ubi->buf_mutex);
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index d2d12ab7def4..2135a53732ff 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -1103,7 +1103,7 @@ static int check_what_we_have(struct ubi_device *ubi, struct ubi_scan_info *si)
1103 * otherwise, only print a warning. 1103 * otherwise, only print a warning.
1104 */ 1104 */
1105 if (si->corr_peb_count >= max_corr) { 1105 if (si->corr_peb_count >= max_corr) {
1106 ubi_err("too many corrupted PEBs, refusing this device"); 1106 ubi_err("too many corrupted PEBs, refusing");
1107 return -EINVAL; 1107 return -EINVAL;
1108 } 1108 }
1109 } 1109 }
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h
index 503ea9b27309..6fb8ec2174a5 100644
--- a/drivers/mtd/ubi/ubi-media.h
+++ b/drivers/mtd/ubi/ubi-media.h
@@ -164,7 +164,7 @@ struct ubi_ec_hdr {
164 __be32 image_seq; 164 __be32 image_seq;
165 __u8 padding2[32]; 165 __u8 padding2[32];
166 __be32 hdr_crc; 166 __be32 hdr_crc;
167} __attribute__ ((packed)); 167} __packed;
168 168
169/** 169/**
170 * struct ubi_vid_hdr - on-flash UBI volume identifier header. 170 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
@@ -292,7 +292,7 @@ struct ubi_vid_hdr {
292 __be64 sqnum; 292 __be64 sqnum;
293 __u8 padding3[12]; 293 __u8 padding3[12];
294 __be32 hdr_crc; 294 __be32 hdr_crc;
295} __attribute__ ((packed)); 295} __packed;
296 296
297/* Internal UBI volumes count */ 297/* Internal UBI volumes count */
298#define UBI_INT_VOL_COUNT 1 298#define UBI_INT_VOL_COUNT 1
@@ -373,6 +373,6 @@ struct ubi_vtbl_record {
373 __u8 flags; 373 __u8 flags;
374 __u8 padding[23]; 374 __u8 padding[23];
375 __be32 crc; 375 __be32 crc;
376} __attribute__ ((packed)); 376} __packed;
377 377
378#endif /* !__UBI_MEDIA_H__ */ 378#endif /* !__UBI_MEDIA_H__ */
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index f1be8b79663c..c6c22295898e 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -341,8 +341,8 @@ struct ubi_wl_entry;
341 * protected from the wear-leveling worker) 341 * protected from the wear-leveling worker)
342 * @pq_head: protection queue head 342 * @pq_head: protection queue head
343 * @wl_lock: protects the @used, @free, @pq, @pq_head, @lookuptbl, @move_from, 343 * @wl_lock: protects the @used, @free, @pq, @pq_head, @lookuptbl, @move_from,
344 * @move_to, @move_to_put @erase_pending, @wl_scheduled, @works, 344 * @move_to, @move_to_put @erase_pending, @wl_scheduled, @works,
345 * @erroneous, and @erroneous_peb_count fields 345 * @erroneous, and @erroneous_peb_count fields
346 * @move_mutex: serializes eraseblock moves 346 * @move_mutex: serializes eraseblock moves
347 * @work_sem: synchronizes the WL worker with use tasks 347 * @work_sem: synchronizes the WL worker with use tasks
348 * @wl_scheduled: non-zero if the wear-leveling was scheduled 348 * @wl_scheduled: non-zero if the wear-leveling was scheduled
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index b4cf57db2556..ff2c4956eeff 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1570,7 +1570,8 @@ void ubi_wl_close(struct ubi_device *ubi)
1570 * @ec: the erase counter to check 1570 * @ec: the erase counter to check
1571 * 1571 *
1572 * This function returns zero if the erase counter of physical eraseblock @pnum 1572 * This function returns zero if the erase counter of physical eraseblock @pnum
1573 * is equivalent to @ec, and a negative error code if not or if an error occurred. 1573 * is equivalent to @ec, and a negative error code if not or if an error
1574 * occurred.
1574 */ 1575 */
1575static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) 1576static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec)
1576{ 1577{