diff mbox series

[1/5] slimbus: stream: add checks for invalid unprepare/disable usage

Message ID 20220923155740.422411-1-krzysztof.kozlowski@linaro.org
State Accepted
Commit a82b1ec34e9bea94058f429560e311e5ca634356
Headers show
Series [1/5] slimbus: stream: add checks for invalid unprepare/disable usage | expand

Commit Message

Krzysztof Kozlowski Sept. 23, 2022, 3:57 p.m. UTC
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(+)

Comments

Krzysztof Kozlowski Oct. 26, 2022, 4:30 p.m. UTC | #1
On 23/09/2022 11:57, Krzysztof Kozlowski wrote:
> 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 ++++++


Hi Srini,

Any comments on these patches? Can they be picked up?

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 26, 2022, 4:31 p.m. UTC | #2
On 23/09/2022 11:57, Krzysztof Kozlowski wrote:
> 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>
> ---

Hi Srini,

This patchset is also waiting for a month without comments.

Best regards,
Krzysztof
Srinivas Kandagatla Oct. 31, 2022, 6:28 p.m. UTC | #3
On 23/09/2022 16:57, Krzysztof Kozlowski wrote:
> 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>
> ---

Applied all.
thanks,
--srini
>   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]);
>
diff mbox series

Patch

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]);