diff mbox series

[2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path()

Message ID 20220121202952.24763-3-danielhb413@gmail.com (mailing list archive)
State New, archived
Headers show
Series some simplifications in hw/core/fw-path-provider.c | expand

Commit Message

Daniel Henrique Barboza Jan. 21, 2022, 8:29 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
index 4bcf4e7e34..b8fa649fe2 100644
--- a/hw/core/fw-path-provider.c
+++ b/hw/core/fw-path-provider.c
@@ -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 = {