qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 2/4] usb-mtp: fix some usb_mtp_write_data return


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 2/4] usb-mtp: fix some usb_mtp_write_data return paths
Date: Thu, 14 Mar 2019 16:37:14 +0000

On Fri, 8 Mar 2019 at 19:39, Bandan Das <address@hidden> wrote:
>
> Peter Maydell <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]