Skip to content

Commit 503990e

Browse files
Artem BityutskiyArtem Bityutskiy
authored andcommitted
UBI: remove unneeded error checks
Pointed to by viro. Signed-off-by: Artem Bityutskiy <[email protected]>
1 parent 2db61c9 commit 503990e

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

drivers/mtd/ubi/build.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,6 @@ static int __init ubi_init(void)
685685
struct mtd_dev_param *p = &mtd_dev_param[i];
686686

687687
cond_resched();
688-
689-
if (!p->name) {
690-
dbg_err("empty name");
691-
err = -EINVAL;
692-
goto out_detach;
693-
}
694-
695688
err = attach_mtd_dev(p->name, p->vid_hdr_offs, p->data_offs);
696689
if (err)
697690
goto out_detach;
@@ -798,7 +791,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
798791

799792
/* Get rid of the final newline */
800793
if (buf[len - 1] == '\n')
801-
buf[len - 1] = 0;
794+
buf[len - 1] = '\0';
802795

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

811-
if (tokens[0] == '\0')
812-
return -EINVAL;
813-
814804
p = &mtd_dev_param[mtd_devs];
815805
strcpy(&p->name[0], tokens[0]);
816806

drivers/mtd/ubi/kapi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
3838
const struct ubi_device *ubi;
3939

4040
if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES ||
41-
!ubi_devices[ubi_num]) {
41+
!ubi_devices[ubi_num])
4242
return -ENODEV;
43-
}
4443

4544
ubi = ubi_devices[ubi_num];
4645
di->ubi_num = ubi->ubi_num;

0 commit comments

Comments
 (0)