Skip to content

Commit

Permalink
net: l2: ethernet: check if the dev->api not NULL
Browse files Browse the repository at this point in the history
adds a check for Ethernet driver's API not being NULL in ethernet_mcast_monitor_cb

Signed-off-by: Maciej Panek <[email protected]>
  • Loading branch information
panekmaciej committed Sep 1, 2024
1 parent 63fdd93 commit 248af28
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions subsys/net/l2/ethernet/ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,20 @@ static void ethernet_mcast_monitor_cb(struct net_if *iface, const struct net_add
.type = ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
},
};
const struct device *dev;
const struct ethernet_api *api;

Check failure on line 199 in subsys/net/l2/ethernet/ethernet.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TRAILING_WHITESPACE

subsys/net/l2/ethernet/ethernet.c:199 trailing whitespace
const struct device *dev = net_if_get_device(iface);

Check notice on line 200 in subsys/net/l2/ethernet/ethernet.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/l2/ethernet/ethernet.c:200 - +
const struct ethernet_api *api = dev->api;

/* Make sure we're an ethernet device */
if (net_if_l2(iface) != &NET_L2_GET_NAME(ETHERNET)) {
return;
}

dev = net_if_get_device(iface);
api = dev->api;
if (!(net_eth_get_hw_capabilities(iface) & ETHERNET_HW_FILTERING)) {
return;
}

if (!(net_eth_get_hw_capabilities(iface) & ETHERNET_HW_FILTERING) || api->set_config == NULL) {
if (!api || !api->set_config) {
return;
}

Expand Down

0 comments on commit 248af28

Please sign in to comment.