backends: Simplify host_memory_backend_memory_complete()
Return early if bc->alloc is NULL. De-indent the if() ladder. Note, this avoids a pointless call to error_propagate() with errp=NULL at the 'out:' label. Change trivial when reviewed with 'git-diff --ignore-all-space'. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Gavin Shan <gshan@redhat.com> Message-Id: <20231120213301.24349-16-philmd@linaro.org>
This commit is contained in:
parent
2d7a1eb6e6
commit
e199f7ad4d
@ -328,7 +328,9 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
void *ptr;
|
||||
uint64_t sz;
|
||||
|
||||
if (bc->alloc) {
|
||||
if (!bc->alloc) {
|
||||
return;
|
||||
}
|
||||
bc->alloc(backend, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
@ -406,7 +408,6 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user