@@ -19,25 +19,17 @@
#include "hw/fw-path-provider.h"
#include "qemu/module.h"
-static char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
- DeviceState *dev)
-{
- FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
-
- return k->get_dev_path(p, bus, dev);
-}
-
char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
DeviceState *dev)
{
FWPathProvider *p = (FWPathProvider *)
object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
- if (p) {
- return fw_path_provider_get_dev_path(p, bus, dev);
+ if (!p) {
+ return NULL;
}
- return NULL;
+ return FW_PATH_PROVIDER_GET_CLASS(p)->get_dev_path(p, bus, dev);
}
static const TypeInfo fw_path_provider_info = {
fw_path_provider_get_dev_path() is 2 lines long and it's used only by fw_path_provider_try_get_dev_path(), which checks if FWPathProvider is not NULL before calling it. Open coding fw_path_provider_get_dev_path() into fw_path_provider_try_get_dev_path() simplifies the code inside fw-path-provider.c and make it easier to grep our way into finding the callers of the FWPathProviderClass::get_dev_path() interface. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- hw/core/fw-path-provider.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)