On Fri, 8 Mar 2019 at 19:39, Bandan Das <b...@redhat.com> wrote: > > Peter Maydell <peter.mayd...@linaro.org> writes: > > But the two places in usb_mtp_get_data() that call > > usb_mtp_write_metadata() still don't check its return > > value: don't they need to handle failure too? > > > I believe this is ok because: > The return value of usb_mtp_write_data is only used to check if mkdir > failed and update s->result in usb_mtp_write_metadata(). > The next time usb_mtp_handle_data is called, it will process s->result.
I think I still don't really understand the error handling in this function. Why do we deal with mkdir() failing by having the function return -1 and then doing usb_mtp_queue_result(s, RES_STORE_FULL, ...) (but only at one callsite), whereas for open() or write() failing we do the usb_mtp_queue_result(s, RES_STORE_FULL, ...) inside the function itself? thanks -- PMM