mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
usb: gadget: dfu: discard dead code
Reported by Coverity: Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: (f_dfu->strings + --i).s = .... If calloc failed, i is still 0 and no need to call free, so discard the dead code. Signed-off-by: Peng Fan <van.freenix@gmail.com> Cc: "Łukasz Majewski" <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
This commit is contained in:
@ -636,7 +636,7 @@ dfu_prepare_strings(struct f_dfu *f_dfu, int n)
|
|||||||
|
|
||||||
f_dfu->strings = calloc(sizeof(struct usb_string), n + 1);
|
f_dfu->strings = calloc(sizeof(struct usb_string), n + 1);
|
||||||
if (!f_dfu->strings)
|
if (!f_dfu->strings)
|
||||||
goto enomem;
|
return -ENOMEM;
|
||||||
|
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
de = dfu_get_entity(i);
|
de = dfu_get_entity(i);
|
||||||
@ -647,14 +647,6 @@ dfu_prepare_strings(struct f_dfu *f_dfu, int n)
|
|||||||
f_dfu->strings[i].s = NULL;
|
f_dfu->strings[i].s = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
enomem:
|
|
||||||
while (i)
|
|
||||||
f_dfu->strings[--i].s = NULL;
|
|
||||||
|
|
||||||
free(f_dfu->strings);
|
|
||||||
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dfu_prepare_function(struct f_dfu *f_dfu, int n)
|
static int dfu_prepare_function(struct f_dfu *f_dfu, int n)
|
||||||
|
Reference in New Issue
Block a user