From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PATCH 3/3] usb-mtp: handle usb_mtp_get_object failure
Date: Tue, 20 May 2014 13:24:22 +0200 [thread overview]
Message-ID: <1400585062-13260-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1400585062-13260-1-git-send-email-kraxel@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-mtp.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index a95298b..380b465 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -46,6 +46,7 @@ enum mtp_code {
/* response codes */
RES_OK = 0x2001,
+ RES_GENERAL_ERROR = 0x2002,
RES_SESSION_NOT_OPEN = 0x2003,
RES_INVALID_TRANSACTION_ID = 0x2004,
RES_OPERATION_NOT_SUPPORTED = 0x2005,
@@ -828,7 +829,9 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
}
data_in = usb_mtp_get_object(s, c, o);
if (NULL == data_in) {
- fprintf(stderr, "%s: TODO: handle error\n", __func__);
+ usb_mtp_queue_result(s, RES_GENERAL_ERROR,
+ c->trans, 0, 0, 0);
+ return;
}
break;
case CMD_GET_PARTIAL_OBJECT:
@@ -845,7 +848,9 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
}
data_in = usb_mtp_get_partial_object(s, c, o);
if (NULL == data_in) {
- fprintf(stderr, "%s: TODO: handle error\n", __func__);
+ usb_mtp_queue_result(s, RES_GENERAL_ERROR,
+ c->trans, 0, 0, 0);
+ return;
}
nres = 1;
res0 = data_in->length;
--
1.8.3.1
prev parent reply other threads:[~2014-05-20 11:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 11:24 [Qemu-devel] [PATCH 1/3] usb-mtp: use bool to track MTPObject init status Gerd Hoffmann
2014-05-20 11:24 ` [Qemu-devel] [PATCH 2/3] usb-mtp: handle lseek failure Gerd Hoffmann
2014-05-20 11:24 ` Gerd Hoffmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400585062-13260-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).