Skip to content

Commit 93c590c

Browse files
maciejbaczmanskirlubos
authored andcommitted
[nrf fromtree] drivers: ieee802154: fix handling of struct ieee802154_config
`struct ieee802154_config config` is a struct containing an union. Members of `config` were accessed incorrectly in `otPlatRadioEnableCsl`. Fix by initializing `config` with `0` and accessing one member at a time. Signed-off-by: Maciej Baczmanski <[email protected]> (cherry picked from commit 36b7f44)
1 parent 02e7e0f commit 93c590c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

modules/openthread/platform/radio.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,10 +1255,7 @@ void otPlatRadioSetMacFrameCounterIfLarger(otInstance *aInstance, uint32_t aMacF
12551255
otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr,
12561256
const otExtAddress *aExtAddr)
12571257
{
1258-
struct ieee802154_config config = {
1259-
.ack_ie.short_addr = aShortAddr,
1260-
.ack_ie.ext_addr = aExtAddr->m8,
1261-
};
1258+
struct ieee802154_config config = { 0 };
12621259
int result;
12631260

12641261
ARG_UNUSED(aInstance);
@@ -1271,6 +1268,8 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort
12711268
if (result) {
12721269
return OT_ERROR_FAILED;
12731270
}
1271+
config.ack_ie.short_addr = aShortAddr;
1272+
config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL;
12741273

12751274
/* Configure the CSL IE. */
12761275
if (aCslPeriod > 0) {

0 commit comments

Comments
 (0)