Skip to content

Commit

Permalink
UBI: remove unneeded error checks
Browse files Browse the repository at this point in the history
Pointed to by viro.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jul 18, 2007
1 parent 2db61c9 commit 503990e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
12 changes: 1 addition & 11 deletions drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,13 +685,6 @@ static int __init ubi_init(void)
struct mtd_dev_param *p = &mtd_dev_param[i];

cond_resched();

if (!p->name) {
dbg_err("empty name");
err = -EINVAL;
goto out_detach;
}

err = attach_mtd_dev(p->name, p->vid_hdr_offs, p->data_offs);
if (err)
goto out_detach;
Expand Down Expand Up @@ -798,7 +791,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)

/* Get rid of the final newline */
if (buf[len - 1] == '\n')
buf[len - 1] = 0;
buf[len - 1] = '\0';

for (i = 0; i < 3; i++)
tokens[i] = strsep(&pbuf, ",");
Expand All @@ -808,9 +801,6 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
return -EINVAL;
}

if (tokens[0] == '\0')
return -EINVAL;

p = &mtd_dev_param[mtd_devs];
strcpy(&p->name[0], tokens[0]);

Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/ubi/kapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
const struct ubi_device *ubi;

if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES ||
!ubi_devices[ubi_num]) {
!ubi_devices[ubi_num])
return -ENODEV;
}

ubi = ubi_devices[ubi_num];
di->ubi_num = ubi->ubi_num;
Expand Down

0 comments on commit 503990e

Please sign in to comment.