mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] slimbus: stream: add checks for invalid unprepare/disable usage
@ 2022-09-23 15:57 Krzysztof Kozlowski
  2022-09-23 15:57 ` [PATCH 2/5] slimbus: qcom-ctrl: drop unneeded qcom,apq8064-slim compatible Krzysztof Kozlowski
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-23 15:57 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Srinivas Kandagatla,
	linux-arm-msm, alsa-devel, linux-kernel
  Cc: Krzysztof Kozlowski

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>
---
 drivers/slimbus/stream.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c
index 75f87b3d8b95..7bb073ca6006 100644
--- a/drivers/slimbus/stream.c
+++ b/drivers/slimbus/stream.c
@@ -407,6 +407,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);
 
@@ -438,6 +441,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]);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-31 18:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 15:57 [PATCH 1/5] slimbus: stream: add checks for invalid unprepare/disable usage Krzysztof Kozlowski
2022-09-23 15:57 ` [PATCH 2/5] slimbus: qcom-ctrl: drop unneeded qcom,apq8064-slim compatible Krzysztof Kozlowski
2022-09-26  8:03   ` Neil Armstrong
2022-09-23 15:57 ` [PATCH 3/5] slimbus: qcom-ctrl: use devm_platform_ioremap_resource_byname() Krzysztof Kozlowski
2022-09-26  8:03   ` Neil Armstrong
2022-09-23 15:57 ` [PATCH 4/5] slimbus: qcom-ngd-ctrl: use devm_platform_get_and_ioremap_resource() Krzysztof Kozlowski
2022-09-26  8:03   ` Neil Armstrong
2022-09-23 15:57 ` [PATCH 5/5] slimbus: qcom-ngd-ctrl: reinit the reconf completion flag Krzysztof Kozlowski
2022-10-26 16:30 ` [PATCH 1/5] slimbus: stream: add checks for invalid unprepare/disable usage Krzysztof Kozlowski
2022-10-26 16:31 ` Krzysztof Kozlowski
2022-10-31 18:28 ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®