New upstream version 18.11-rc2
[deb_dpdk.git] / drivers / bus / dpaa / base / fman / fman.c
index bda62e0..06762e0 100644 (file)
@@ -13,6 +13,7 @@
 #include <fman.h>
 #include <of.h>
 #include <rte_dpaa_logs.h>
+#include <rte_string_fns.h>
 
 #define QMI_PORT_REGS_OFFSET           0x400
 
@@ -183,7 +184,7 @@ fman_if_init(const struct device_node *dpa_node)
        }
        memset(__if, 0, sizeof(*__if));
        INIT_LIST_HEAD(&__if->__if.bpool_list);
-       strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
+       strlcpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
        __if->node_path[PATH_MAX - 1] = '\0';
 
        /* Obtain the MAC node used by this interface except macless */
@@ -300,7 +301,7 @@ fman_if_init(const struct device_node *dpa_node)
 
        _errno = fman_get_mac_index(regs_addr_host, &__if->__if.mac_idx);
        if (_errno) {
-               FMAN_ERR(-EINVAL, "Invalid register address: %lu",
+               FMAN_ERR(-EINVAL, "Invalid register address: %" PRIx64,
                         regs_addr_host);
                goto err;
        }
@@ -442,6 +443,7 @@ fman_if_init(const struct device_node *dpa_node)
                if (!pool_node) {
                        FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n",
                                 dname);
+                       free(bpool);
                        goto err;
                }
                pname = pool_node->full_name;
@@ -449,6 +451,7 @@ fman_if_init(const struct device_node *dpa_node)
                prop = of_get_property(pool_node, "fsl,bpid", &proplen);
                if (!prop) {
                        FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", pname);
+                       free(bpool);
                        goto err;
                }
                assert(proplen == sizeof(*prop));
@@ -502,7 +505,7 @@ fman_if_init(const struct device_node *dpa_node)
 
        /* Parsing of the network interface is complete, add it to the list */
        DPAA_BUS_LOG(DEBUG, "Found %s, Tx Channel = %x, FMAN = %x,"
-                   "Port ID = %x\n",
+                   "Port ID = %x",
                    dname, __if->__if.tx_channel_id, __if->__if.fman_idx,
                    __if->__if.mac_idx);