spmi: mediatek: add device id check
Subsystems (2)
PATCH v2 1/1 spmi: mediatek: add device id check
Add device id check for spmi write API.
Signed-off-by Sen Chu <[email protected]>
---
Change in v1:
Fix: this should be unlikely(sid & ~0xf)
[Sen Chu <[email protected]>]
---
--- drivers/spmi/spmi-mtk-pmif.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/spmi/spmi-mtk-pmif.c +6 -0
@@ -378,6 +378,12 @@ static int pmif_spmi_write_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,int ret;u32 data, cmd; +/* Check for argument validation. */ +if (unlikely (sid & ~0xf )) { +dev_err (&ctrl->dev,"exceed the max slv id\n" ); +return -EINVAL ; + } +if (len >4 ) {dev_err (&ctrl->dev,"pmif supports 1..4 bytes per trans, but:%zu requested" , len);
Signature · 1 line
2.18.0
Il 18/05/23 06:07, Sen Chu ha scritto:
Quoted 3 lines
Add device id check for spmi write API.
Signed-off-by Sen Chu <[email protected]>
Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Quoting Sen Chu (2023-05-17 21:07:29)
Quoted 4 lines
Add device id check for spmi write API.
Signed-off-by Sen Chu <[email protected]>---
Applied to spmi-next