bus/fslmc: fix iterating on a class type
[dpdk.git] / drivers / bus / fslmc / fslmc_bus.c
index b3e964a..ac46eb4 100644 (file)
@@ -115,14 +115,9 @@ static void
 dump_device_list(void)
 {
        struct rte_dpaa2_device *dev;
-       uint32_t global_log_level;
-       int local_log_level;
 
        /* Only if the log level has been set to Debugging, print list */
-       global_log_level = rte_log_get_global_level();
-       local_log_level = rte_log_get_level(dpaa2_logtype_bus);
-       if (global_log_level == RTE_LOG_DEBUG ||
-           local_log_level == RTE_LOG_DEBUG) {
+       if (rte_log_can_log(dpaa2_logtype_bus, RTE_LOG_DEBUG)) {
                DPAA2_BUS_LOG(DEBUG, "List of devices scanned on bus:");
                TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
                        DPAA2_BUS_LOG(DEBUG, "\t\t%s", dev->device.name);
@@ -608,6 +603,11 @@ fslmc_bus_dev_iterate(const void *start, const char *str,
        struct rte_dpaa2_device *dev;
        char *dup, *dev_name = NULL;
 
+       if (str == NULL) {
+               DPAA2_BUS_DEBUG("No device string");
+               return NULL;
+       }
+
        /* Expectation is that device would be name=device_name */
        if (strncmp(str, "name=", 5) != 0) {
                DPAA2_BUS_DEBUG("Invalid device string (%s)\n", str);