From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBA13289820 for ; Wed, 21 May 2025 18:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747852488; cv=none; b=Ufbyu8yluiCBPgiT9BtdBe1eF+3L9j5NtZ9cV/9tMeGIcFQKKi+9BWyxOE3qHp8rhvksIw6FD8RSKve22z2F/C4C4lqD/frwdvyQF/Wda/o/7/CnYcBT/RcZSFbG2Z6T2KO9gY9j4a9Hew9kYICRdRD7TH2CaXehfz9idxB6EvM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747852488; c=relaxed/simple; bh=+PkIbYw7f9LTQDvfwkhpEXwqALZrau6Ky/DkN8EFq0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=djNiI9CQEVweLgo/Kdhx2RXvYkGhePgDh8um4IfeAXYuxQWb/cms+qFMQkd+bcyP/nHlgCyG4whjX3zpH64tl2Xg2N7de+pHA3kga7qvu672PEb97Q1Ib47sqDaQtbnO3WOtmvjDQcGu9kqp7pJTs3+FL2DgIZKut0mhD9zmGnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1132AC4CEE4; Wed, 21 May 2025 18:34:48 +0000 (UTC) From: Dave Jiang To: linux-cxl@vger.kernel.org Cc: dave@stgolabs.net, jonathan.cameron@huawei.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, dan.j.williams@intel.com, Gregory Price , Li Ming , Jonathan Cameron Subject: [PATCH v3 1/9] cxl/region: Add decoder check to check_commit_order() Date: Wed, 21 May 2025 11:34:35 -0700 Message-ID: <20250521183443.3828320-2-dave.jiang@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250521183443.3828320-1-dave.jiang@intel.com> References: <20250521183443.3828320-1-dave.jiang@intel.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit check_commit_order() attempts to convert a device to a decoder without making sure the device is a decoder. So far this has been working due to pure luck. Issue discovered while doing deferred dport probing when child ports are now in the midst of decoders due to ordering change of child port additions. Add a check before attempting to do decoder conversion. Reviewed-by: Gregory Price Reviewed-by: Li Ming Reviewed-by: Alison Schofield Reviewed-by: Jonathan Cameron Signed-off-by: Dave Jiang --- drivers/cxl/core/region.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index c3f4dc244df7..a91d4eb061e4 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -788,7 +788,12 @@ static size_t show_targetN(struct cxl_region *cxlr, char *buf, int pos) static int check_commit_order(struct device *dev, void *data) { - struct cxl_decoder *cxld = to_cxl_decoder(dev); + struct cxl_decoder *cxld; + + if (!is_switch_decoder(dev)) + return 0; + + cxld = to_cxl_decoder(dev); /* * if port->commit_end is not the only free decoder, then out of -- 2.49.0