1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/at86rf2xx: fix NETOPT_RANDOM

- fix wrong return value
- fix wrong size parameter
    - note, the behavior is a bit relaxed in that it allows
      NETOPT_RANDOM with different size than `sizeof(uint32_t)`
This commit is contained in:
Marian Buschsieweke 2022-07-11 08:04:18 +02:00
parent 2e0746d11d
commit 240cf75a61
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -461,9 +461,8 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len)
#endif /* MODULE_NETDEV_IEEE802154_OQPSK */
#if AT86RF2XX_RANDOM_NUMBER_GENERATOR
case NETOPT_RANDOM:
assert(max_len >= sizeof(uint32_t));
at86rf2xx_get_random(dev, (uint8_t*)val, sizeof(val));
break;
at86rf2xx_get_random(dev, (uint8_t*)val, max_len);
return max_len;
#endif
default:
res = -ENOTSUP;