drivers: ethernet: gmac: fix coverity issue
If return value is negative (failed) then log the error with a message. Coverity-CID: 219519 Fixes #32927 Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
This commit is contained in:
parent
29f4574052
commit
bf93d4f1a0
1 changed files with 9 additions and 3 deletions
|
@ -1785,6 +1785,7 @@ static void get_mac_addr_from_i2c_eeprom(uint8_t mac_addr[6])
|
||||||
{
|
{
|
||||||
const struct device *dev;
|
const struct device *dev;
|
||||||
uint32_t iaddr = CONFIG_ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS;
|
uint32_t iaddr = CONFIG_ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS;
|
||||||
|
int ret;
|
||||||
|
|
||||||
dev = device_get_binding(CONFIG_ETH_SAM_GMAC_MAC_I2C_DEV_NAME);
|
dev = device_get_binding(CONFIG_ETH_SAM_GMAC_MAC_I2C_DEV_NAME);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
@ -1792,9 +1793,14 @@ static void get_mac_addr_from_i2c_eeprom(uint8_t mac_addr[6])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
i2c_write_read(dev, CONFIG_ETH_SAM_GMAC_MAC_I2C_SLAVE_ADDRESS,
|
ret = i2c_write_read(dev, CONFIG_ETH_SAM_GMAC_MAC_I2C_SLAVE_ADDRESS,
|
||||||
&iaddr, CONFIG_ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS_SIZE,
|
&iaddr, CONFIG_ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS_SIZE,
|
||||||
mac_addr, 6);
|
mac_addr, 6);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
LOG_ERR("I2C: failed to read MAC addr");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue