device: use empty string as drvname when devicetree label is absent
As we move to making the `label` property optional, we need to account for widespread use of `dev->name` in contexts where the pointer is not validated before it is dereferenced. Use an empty string instead of a null pointer when no label is provided. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
5b36a01a67
commit
28897df295
3 changed files with 3 additions and 3 deletions
|
@ -2269,7 +2269,7 @@ struct net_if_api {
|
|||
#define NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, data, cfg, \
|
||||
prio, api, l2, l2_ctx_type, mtu) \
|
||||
Z_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||
DT_PROP_OR(node_id, label, NULL), init_fn, \
|
||||
DT_PROP_OR(node_id, label, ""), init_fn, \
|
||||
pm_control_fn, data, cfg, prio, api, l2, \
|
||||
l2_ctx_type, mtu)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue