]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/pch_gbe.c
Fix GCC format-security errors and convert sprintfs.
[u-boot] / drivers / net / pch_gbe.c
index 004fcf88c207066b3b6aa03e3d9010c38561e07f..56d29d47af71c33750fc5954fafee7dffc6b0601 100644 (file)
@@ -386,7 +386,7 @@ static int pch_gbe_mdio_init(const char *name, struct pch_gbe_regs *mac_regs)
 
        bus->read = pch_gbe_mdio_read;
        bus->write = pch_gbe_mdio_write;
-       sprintf(bus->name, name);
+       strcpy(bus->name, name);
 
        bus->priv = (void *)mac_regs;
 
@@ -424,7 +424,7 @@ int pch_gbe_probe(struct udevice *dev)
        pci_dev_t devno;
        u32 iobase;
 
-       devno = pci_get_bdf(dev);
+       devno = dm_pci_get_bdf(dev);
 
        /*
         * The priv structure contains the descriptors and frame buffers which
@@ -452,6 +452,17 @@ int pch_gbe_probe(struct udevice *dev)
        return pch_gbe_phy_init(dev);
 }
 
+int pch_gbe_remove(struct udevice *dev)
+{
+       struct pch_gbe_priv *priv = dev_get_priv(dev);
+
+       free(priv->phydev);
+       mdio_unregister(priv->bus);
+       mdio_free(priv->bus);
+
+       return 0;
+}
+
 static const struct eth_ops pch_gbe_ops = {
        .start = pch_gbe_start,
        .send = pch_gbe_send,
@@ -470,6 +481,7 @@ U_BOOT_DRIVER(eth_pch_gbe) = {
        .id = UCLASS_ETH,
        .of_match = pch_gbe_ids,
        .probe = pch_gbe_probe,
+       .remove = pch_gbe_remove,
        .ops = &pch_gbe_ops,
        .priv_auto_alloc_size = sizeof(struct pch_gbe_priv),
        .platdata_auto_alloc_size = sizeof(struct eth_pdata),