提交 a82b1ec3 编写于 作者: K Krzysztof Kozlowski 提交者: Greg Kroah-Hartman

slimbus: stream: add checks for invalid unprepare/disable usage

slim_disable_stream() and slim_stream_unprepare() are exported, so add
sanity checks preventing unmatched/invalid calls.
Signed-off-by: NKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221118065246.6835-6-srinivas.kandagatla@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4594cb4b
......@@ -414,6 +414,9 @@ int slim_stream_disable(struct slim_stream_runtime *stream)
struct slim_controller *ctrl = stream->dev->ctrl;
int ret, i;
if (!stream->ports || !stream->num_ports)
return -EINVAL;
if (ctrl->disable_stream)
ctrl->disable_stream(stream);
......@@ -445,6 +448,9 @@ int slim_stream_unprepare(struct slim_stream_runtime *stream)
{
int i;
if (!stream->ports || !stream->num_ports)
return -EINVAL;
for (i = 0; i < stream->num_ports; i++)
slim_disconnect_port(stream, &stream->ports[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册