mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 06:21:52 -06:00
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>
This commit is contained in:
parent
4bc1591681
commit
b396733df3
1 changed files with 2 additions and 12 deletions
|
@ -1150,16 +1150,6 @@ enum {
|
||||||
DELETE_PARTIAL = (DELETE_FAILURE | DELETE_SUCCESS),
|
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)
|
static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans)
|
||||||
{
|
{
|
||||||
MTPObject *iter, *iter2;
|
MTPObject *iter, *iter2;
|
||||||
|
@ -1181,14 +1171,14 @@ static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans)
|
||||||
if (remove(o->path)) {
|
if (remove(o->path)) {
|
||||||
ret |= DELETE_FAILURE;
|
ret |= DELETE_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
usb_mtp_object_free_one(s, o);
|
usb_mtp_object_free(s, o);
|
||||||
ret |= DELETE_SUCCESS;
|
ret |= DELETE_SUCCESS;
|
||||||
}
|
}
|
||||||
} else if (o->format == FMT_ASSOCIATION) {
|
} else if (o->format == FMT_ASSOCIATION) {
|
||||||
if (rmdir(o->path)) {
|
if (rmdir(o->path)) {
|
||||||
ret |= DELETE_FAILURE;
|
ret |= DELETE_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
usb_mtp_object_free_one(s, o);
|
usb_mtp_object_free(s, o);
|
||||||
ret |= DELETE_SUCCESS;
|
ret |= DELETE_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue