Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion drivers/ethernet/eth_lan9250.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,15 @@
return ret;
}
lan9250_configure(dev);

ret = net_eth_mac_load(&config->mac_cfg, context->mac_address);
if (ret == -ENODATA) {
LOG_WRN("No MAC address configured for %s", dev->name);
} else if (ret < 0) {

Check failure on line 704 in drivers/ethernet/eth_lan9250.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

End this if...else if construct by an else clause.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZrbDPL8O_d3IRV7uP0N&open=AZrbDPL8O_d3IRV7uP0N&pullRequest=100320
LOG_ERR("Failed to load MAC address (%d)", ret);
return ret;
}

lan9250_set_macaddr(dev);

k_thread_create(&context->thread, context->thread_stack,
Expand All @@ -710,7 +719,6 @@

#define LAN9250_DEFINE(inst) \
static struct lan9250_runtime lan9250_##inst##_runtime = { \
.mac_address = DT_INST_PROP_OR(inst, local_mac_address, {0}), \
.tx_rx_sem = Z_SEM_INITIALIZER(lan9250_##inst##_runtime.tx_rx_sem, 1, UINT_MAX), \
.int_sem = Z_SEM_INITIALIZER(lan9250_##inst##_runtime.int_sem, 0, UINT_MAX), \
}; \
Expand All @@ -719,6 +727,7 @@
.spi = SPI_DT_SPEC_INST_GET(inst, SPI_WORD_SET(8)), \
.interrupt = GPIO_DT_SPEC_INST_GET(inst, int_gpios), \
.timeout = CONFIG_ETH_LAN9250_BUF_ALLOC_TIMEOUT, \
.mac_cfg = NET_ETH_MAC_DT_INST_CONFIG_INIT(inst), \
}; \
\
ETH_NET_DEVICE_DT_INST_DEFINE(inst, lan9250_init, NULL, &lan9250_##inst##_runtime, \
Expand Down
2 changes: 2 additions & 0 deletions drivers/ethernet/eth_lan9250_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/net/ethernet.h>

#ifndef _LAN9250_
#define _LAN9250_
Expand Down Expand Up @@ -312,6 +313,7 @@ struct lan9250_config {
struct gpio_dt_spec reset;
uint8_t full_duplex;
int32_t timeout;
struct net_eth_mac_config mac_cfg;
};

struct lan9250_runtime {
Expand Down