aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2019-04-01 17:17:11 -0400
committerGerd Hoffmann <kraxel@redhat.com>2019-04-02 07:22:49 +0200
commitb396733df3554688c58678f454c34d5c07dd5ca2 (patch)
tree7ffb668d151e45634bcb18e97636f446fda41a97 /hw/usb
parent4bc1591681cbeb4875f57fc99a4f821d032e4bd1 (diff)
usb-mtp: remove usb_mtp_object_free_one
This function is used in the delete path only and can be replaced by a call to usb_mtp_object_free. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Bandan Das <bsd@redhat.com> Message-Id: <20190401211712.19012-3-bsd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/dev-mtp.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 91b820baaf..4dc1317e2e 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1150,16 +1150,6 @@ enum {
DELETE_PARTIAL = (DELETE_FAILURE | DELETE_SUCCESS),
};
-/* Assumes that children, if any, have been already freed */
-static void usb_mtp_object_free_one(MTPState *s, MTPObject *o)
-{
- assert(o->nchildren == 0);
- QTAILQ_REMOVE(&s->objects, o, next);
- g_free(o->name);
- g_free(o->path);
- g_free(o);
-}
-
static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans)
{
MTPObject *iter, *iter2;
@@ -1181,14 +1171,14 @@ static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans)
if (remove(o->path)) {
ret |= DELETE_FAILURE;
} else {
- usb_mtp_object_free_one(s, o);
+ usb_mtp_object_free(s, o);
ret |= DELETE_SUCCESS;
}
} else if (o->format == FMT_ASSOCIATION) {
if (rmdir(o->path)) {
ret |= DELETE_FAILURE;
} else {
- usb_mtp_object_free_one(s, o);
+ usb_mtp_object_free(s, o);
ret |= DELETE_SUCCESS;
}
}