usb/hid: fix infinite loop when N=0
This commit is contained in:
parent
6d514a0b31
commit
de9acf5d48
@ -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
|
/// `read()`. If the dropped future used the same `buf`, then `buf` will
|
||||||
/// contain the full report.
|
/// contain the full report.
|
||||||
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> {
|
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> {
|
||||||
|
assert!(N != 0);
|
||||||
assert!(buf.len() >= N);
|
assert!(buf.len() >= N);
|
||||||
|
|
||||||
// Read packets from the endpoint
|
// Read packets from the endpoint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user