Skip to content

Commit 9992eb9

Browse files
jilaypandyakartben
authored andcommitted
drivers: ethernet: phy_dm8806 fix unchecked return value
Check the return values and log them with error loglevel Signed-off-by: Jilay Pandya <[email protected]>
1 parent 1717b6c commit 9992eb9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/ethernet/phy/phy_dm8806.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,26 @@ static void phy_dm8806_thread_cb(const struct device *dev, struct phy_link_state
257257
uint16_t data;
258258
struct phy_dm8806_data *drv_data = dev->data;
259259
const struct phy_dm8806_config *cfg = dev->config;
260+
int res;
260261

261262
if (drv_data->link_speed_chenge_cb != NULL) {
262263
drv_data->link_speed_chenge_cb(dev, state, cb_data);
263264
}
264265
/* Clear the interrupt flag, by writing "1" to LNKCHG bit of Interrupt Status
265266
* Register (318h)
266267
*/
267-
mdio_read(cfg->mdio, DM8806_INT_STAT_PHY_ADDR, DM8806_INT_STAT_REG_ADDR, &data);
268+
res = mdio_read(cfg->mdio, DM8806_INT_STAT_PHY_ADDR, DM8806_INT_STAT_REG_ADDR, &data);
269+
if (res < 0) {
270+
LOG_ERR("Failed to read regad: %d, error: %d", DM8806_INT_STAT_REG_ADDR, res);
271+
}
272+
268273
data |= 0x1;
269-
mdio_write(cfg->mdio, DM8806_INT_STAT_PHY_ADDR, DM8806_INT_STAT_REG_ADDR, data);
274+
275+
res = mdio_write(cfg->mdio, DM8806_INT_STAT_PHY_ADDR, DM8806_INT_STAT_REG_ADDR, data);
276+
if (res < 0) {
277+
LOG_ERR("Failed to write regad: %d, error: %d", DM8806_INT_STAT_REG_ADDR, res);
278+
}
279+
270280
gpio_pin_interrupt_configure_dt(&cfg->gpio_int, GPIO_INT_EDGE_TO_ACTIVE);
271281
}
272282

0 commit comments

Comments
 (0)