thunderbolt: Check return value of tb_sw_read() in usb4_switch_op()
Subsystems (2)
PATCH 1/1 thunderbolt: Check return value of tb_sw_read() in usb4_switch_op()
The function misses checking return value of tb_sw_read() before it accesses the value that was read. Fix this by checking the return value first.
Fixes b04079837b20 ("thunderbolt: Add initial support for USB4")
Signed-off-by Mika Westerberg <[email protected]>
--- drivers/thunderbolt/usb4.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/thunderbolt/usb4.c +3 -0
@@ -182,6 +182,9 @@ static int usb4_switch_op(struct tb_switch *sw, u16 opcode, u8 *status)return ret; ret =tb_sw_read (sw, &val,TB_CFG_SWITCH ,ROUTER_CS_26 ,1 ); +if (ret) +return ret; +if (val &ROUTER_CS_26_ONS )return -EOPNOTSUPP ;
Signature · 1 line
2.25.1
Quoted 7 lines · Mika Westerberg
The function misses checking return value of
tb_sw_read()before it accesses the value that was read. Fix this by checking the return value first.Fixes b04079837b20 ("thunderbolt: Add initial support for USB4")Signed-off-by Mika Westerberg <[email protected]>
Reviewed-by Yehezkel Bernat <[email protected]>
Mika Westerberg
AppliedQuoted 11 lines · Yehezkel Bernat
Quoted 7 lines · Mika Westerberg
The function misses checking return value of
tb_sw_read()before it accesses the value that was read. Fix this by checking the return value first.Fixes b04079837b20 ("thunderbolt: Add initial support for USB4")Signed-off-by Mika Westerberg <[email protected]>Reviewed-by Yehezkel Bernat <[email protected]>
Applied to fixes, thanks!