Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Krzysztof Kozlowski and committed by
Greg Kroah-Hartman
a82b1ec3 4594cb4b

+6
+6
drivers/slimbus/stream.c
··· 414 414 struct slim_controller *ctrl = stream->dev->ctrl; 415 415 int ret, i; 416 416 417 + if (!stream->ports || !stream->num_ports) 418 + return -EINVAL; 419 + 417 420 if (ctrl->disable_stream) 418 421 ctrl->disable_stream(stream); 419 422 ··· 447 444 int slim_stream_unprepare(struct slim_stream_runtime *stream) 448 445 { 449 446 int i; 447 + 448 + if (!stream->ports || !stream->num_ports) 449 + return -EINVAL; 450 450 451 451 for (i = 0; i < stream->num_ports; i++) 452 452 slim_disconnect_port(stream, &stream->ports[i]);