diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2022-11-18 07:52:39 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-23 19:45:33 +0100 |
commit | a82b1ec34e9bea94058f429560e311e5ca634356 (patch) | |
tree | db57323536e65850bc3413f0d2f0edee8b42acd7 /drivers/slimbus/stream.c | |
parent | slimbus: qcom-ngd-ctrl: add support for 44.1 Khz frequency (diff) | |
download | linux-a82b1ec34e9bea94058f429560e311e5ca634356.tar.xz linux-a82b1ec34e9bea94058f429560e311e5ca634356.zip |
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: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221118065246.6835-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/slimbus/stream.c')
-rw-r--r-- | drivers/slimbus/stream.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c index 7e9c818e66c1..1d6b38657917 100644 --- a/drivers/slimbus/stream.c +++ b/drivers/slimbus/stream.c @@ -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]); |