summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 12:25:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 14:02:20 +0200
commita3976c3a84f204b005835dd6b358d72b18eeffa3 (patch)
tree728bf6f0281f67b54ad00fe02361f607a14a2c8c
parentd1ccb5df97750f0aa61bb70b173bfdfbbe4f0d6b (diff)
downloadbarebox-a3976c3a84f204b005835dd6b358d72b18eeffa3.tar.gz
usbgadget: fastboot: Use function to find file_list entry by name
We have file_list_entry_by_name() now, so use it rather than open coding it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/gadget/f_fastboot.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 5986376..0f2c02e 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -679,18 +679,15 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
fastboot_tx_print(f_fb, "INFOCopying file to %s...", cmd);
- file_list_for_each_entry(f_fb->files, fentry) {
- if (!strcmp(cmd, fentry->name)) {
- filename = fentry->filename;
- break;
- }
- }
+ fentry = file_list_entry_by_name(f_fb->files, cmd);
- if (!filename) {
+ if (!fentry) {
fastboot_tx_print(f_fb, "FAILNo such partition: %s", cmd);
return;
}
+ filename = fentry->filename;
+
if (filetype == filetype_ubi) {
int fd;
struct mtd_info_user meminfo;