Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp183857rwb; Thu, 17 Nov 2022 23:12:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6DUBL62LO5dX8/WJBsq1gw9rJdQG68xnvLEp7Wv0Sgotrj/dcWU8dRAsM8sMBXo21WfxEN X-Received: by 2002:a50:ee0d:0:b0:458:c339:4229 with SMTP id g13-20020a50ee0d000000b00458c3394229mr5001737eds.393.1668755541338; Thu, 17 Nov 2022 23:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668755541; cv=none; d=google.com; s=arc-20160816; b=RJbYcoBCPx9jbBKXIqLHX9vg8a2hDb6238GUSLP6d0lkrebAwpMFmORicX45j0FM30 7g7glYDhdcu8z8GUZSbh6nk/C92ncSSHmCSRqFpKlacFI20RwPpbsi3XTyhPl/42x2se qka1RrOTMNocMsnscD73iXNncIhXSs6ansdmBZrBueIO8NmwEbXFiWf328Z/cGRDQGvf gu/bvILUiNWqjI6VbO55bu/lnES5KbhlhSJY0rMu+D8nIJoHAX+TVDl/D8KZm/ZhRZjn RXUSHAJBXkYKzvq68KU3k9K9W/w1Pvlba4U12wnDMKRNa823Iq6N2QhejhwUFHPxaTZo qwQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Odkf8d759zAm2S3kf+yGGkjhpuHSduq3rr4jcrJwJ2g=; b=tSujvbiDqZyhv4HDK9uaIRwmo3wGVZsd2rdPkCTsIZvIZtwG32FGdTNW66ToCd2htQ LsyTQ+BgvYRQOAzIS//dC3RBJVXNgXsIiDTHcbhHQ05sml/T60GX2DM/XJNWxtDE0sHs CM4DAFYeaL8WpZ/RUNy2o2ryyPKmyio/SWx3zM1o553Mm5ePBMAz+OnDqk722L7xtu1v vVIjIncXt68UCvQRCTbhHqd1ehhGQSeAbT/TJnJA8SD364x8a830pszPCCk0jfL+D5d1 SAJg3s079lwoSdJ1L/L+pHstc8//OxSRGc8jOWN5Q3LUg57H22rkpbEv5rPVhnSlV32y fmjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=brqjbNMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by12-20020a0564021b0c00b0045c9313faf7si2519277edb.353.2022.11.17.23.11.56; Thu, 17 Nov 2022 23:12:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=brqjbNMh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241338AbiKRGx0 (ORCPT + 92 others); Fri, 18 Nov 2022 01:53:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241293AbiKRGxG (ORCPT ); Fri, 18 Nov 2022 01:53:06 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3339720BFE for ; Thu, 17 Nov 2022 22:53:02 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id v1so7753051wrt.11 for ; Thu, 17 Nov 2022 22:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Odkf8d759zAm2S3kf+yGGkjhpuHSduq3rr4jcrJwJ2g=; b=brqjbNMhx/SjMyPuvrG9Vu2y6fKP5ogOjLJ0h8NLtuXXzp689AEwXb3I1b0M6wIfr6 ra40wLbBgDTtulD2gSu62yEDfghJFFRW0r8eiJlhXJv2bo+6bTQ2sgD0V5zQ+o1Z928p DBFki4aIIPI1qtvP8CM0MfICI0E0Oky42+XILgNa66RPJaNoAWb8D0L2l23ulifzaE0p uZMMAAJeAoinA5K5aTlD4W2xpVUmEsnQmQ9+hNX1CPRFbRvVd1SJcM2lAiLzt6H8iKbl NR7fWWQEhg/vk1mDW+e+cw4X1UjEfJOAwofRG3+SAnyT+S2a+PUYUbhgZk8yHOtEzKxZ ODRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Odkf8d759zAm2S3kf+yGGkjhpuHSduq3rr4jcrJwJ2g=; b=p1Atbx2Jf7MBL0Hppy8zOKnFG12n/qSPMe04hvQcacSZsnfxo6sNbXoKqy2+wLNmkQ fCx5fIMODjeagNm980GyNWEEHUJy5HS3R4FjDII32cnNhE8c7fOvPd9mU6JtTzhDn3PR F/J7MPDLP5HypLmE87oGZG13CN//dE5K01kqO4P4i0VSCwuNAZnSlwohr6T0GxMkqfPD Wiw90rThfZ6cGi6AhQhaT9qx+1hn1Z3f4c9z+pxPNyAN7kArgWnHoXnQeEA5ooxHEfeu jRfhNzxOQwziLVPb9LD7IgwCPJqnQxHYVw8LTICNfO4cAHraXjaqKvS2lUH2683RYr0q Cuqg== X-Gm-Message-State: ANoB5pnjJ1ex0C4uGApUxtqkTiBpV0w8MGgqfqdLTuQzpOd34e2O4y0C j1ssjQOA3NL03lkMPRP8YBdRr8jNfCSHEw== X-Received: by 2002:a5d:628e:0:b0:236:5ea4:68c8 with SMTP id k14-20020a5d628e000000b002365ea468c8mr3431594wru.132.1668754380771; Thu, 17 Nov 2022 22:53:00 -0800 (PST) Received: from localhost.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id 23-20020a05600c229700b003cf75213bb9sm7648100wmf.8.2022.11.17.22.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 22:52:59 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 05/12] slimbus: stream: add checks for invalid unprepare/disable usage Date: Fri, 18 Nov 2022 06:52:39 +0000 Message-Id: <20221118065246.6835-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118065246.6835-1-srinivas.kandagatla@linaro.org> References: <20221118065246.6835-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski slim_disable_stream() and slim_stream_unprepare() are exported, so add sanity checks preventing unmatched/invalid calls. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/stream.c | 6 ++++++ 1 file changed, 6 insertions(+) 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]); -- 2.25.1