]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/xilinx_ll_temac.c
include/bitfield.h: Assure new bitfield value doesn't touch unwanted bits
[karo-tx-uboot.git] / drivers / net / xilinx_ll_temac.c
index 85660c0216e725caf793022008601802a8772b13..7cc86571e4952e001f2d5da234795abd520d223a 100644 (file)
  * Copyright (C) 2008 Nissin Systems Co.,Ltd.
  * March 2008 created
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
+ * SPDX-License-Identifier:    GPL-2.0+
  *
  * [0]: http://www.xilinx.com/support/documentation
  *
@@ -232,15 +229,21 @@ static void ll_temac_halt(struct eth_device *dev)
 static int ll_temac_init(struct eth_device *dev, bd_t *bis)
 {
        struct ll_temac *ll_temac = dev->priv;
+       int ret;
 
-       printf("%s: Xilinx XPS LocalLink Tri-Mode Ether MAC #%d at 0x%08X.\n",
+       printf("%s: Xilinx XPS LocalLink Tri-Mode Ether MAC #%d at 0x%08lx.\n",
                dev->name, dev->index, dev->iobase);
 
        if (!ll_temac_setup_ctrl(dev))
                return -1;
 
        /* Start up the PHY */
-       phy_startup(ll_temac->phydev);
+       ret = phy_startup(ll_temac->phydev);
+       if (ret) {
+               printf("%s: Could not initialize PHY %s\n",
+                      dev->name, ll_temac->phydev->dev->name);
+               return ret;
+       }
 
        if (!ll_temac_adjust_link(dev)) {
                ll_temac_halt(dev);
@@ -298,9 +301,9 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
 
        /* use given name or generate its own unique name */
        if (devinf->devname) {
-               strncpy(dev->name, devinf->devname, NAMESIZE);
+               strncpy(dev->name, devinf->devname, sizeof(dev->name));
        } else {
-               snprintf(dev->name, NAMESIZE, "lltemac.%lx", devinf->base_addr);
+               snprintf(dev->name, sizeof(dev->name), "lltemac.%lx", devinf->base_addr);
                devinf->devname = dev->name;
        }