usb/hid: fix infinite loop when N=0

This commit is contained in:
Dario Nieuwenhuis 2022-04-06 02:18:56 +02:00
parent 6d514a0b31
commit de9acf5d48

View File

@ -252,6 +252,7 @@ impl<'d, D: Driver<'d>, const N: usize> ReportReader<'d, D, N> {
/// `read()`. If the dropped future used the same `buf`, then `buf` will
/// contain the full report.
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> {
assert!(N != 0);
assert!(buf.len() >= N);
// Read packets from the endpoint