From patchwork Fri Feb 9 13:45:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 198874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp862709dyd; Fri, 9 Feb 2024 05:50:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGziR63bdzLBgZng9Gu0FXv4hB7AvV9vaghF7jQLeJwIN01KjqDyKC3+anEYZBW9Ebx5Bw1 X-Received: by 2002:a05:6358:6f1a:b0:178:8cc8:4c7b with SMTP id r26-20020a0563586f1a00b001788cc84c7bmr1590379rwn.24.1707486637275; Fri, 09 Feb 2024 05:50:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707486637; cv=pass; d=google.com; s=arc-20160816; b=yMmSXqVxPIkqwBgWosw8Rz2LKSsK5/lMnErF33nnL96m286LMOJtk7NCffLM2RZaTN Jgrcrm46YQRZKstSelQxYdmqNZ1TK784lHj55eD21m4Iyc6altIak6NyD7GZcajDXe2X XIUWTzjK6FzqxeJoiG5oxYk2c14XlSI5C89yJXQmd7Vf1uXzdMvlOqh+e6rk9Lon2wLs zWnNKonsqK6GtG6tAJQmVue62xDdu3dzbV645O4MwOxwVch/23Zx0zcsYVVGKCDn/YYE R1A9Ue17b0YIDTiX9X++ahQhKwjzqxQZpbUv6izN4CfBU0BxCa0Ar6pYI3WpGQ4Uc4AQ flOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=4SqxWl/i5uX0bLJjW8/zyRNlnWT7m4GMIsHrHc5Dq4Y=; fh=TDUkO2NTucfanhuXpyiAQVp2NPBouh2NT67T3yamgyc=; b=kb+qLXiwJZlIR0+JSl468RC0dX/AOmLExdTnzO/rHyYMRG325fQembHR2OGXcWneYz WY17473BEDoeJ8ALQvyjsUB0vbH64EI+au8dGk841wSjCIsapwY7vtJiHkJmJZxLhTCN t6FLgDxyXsO/jTXV68q6Y5H2y7xcUwQDJ82UBti5wBFe1Fqbl7sgOnW7kd5cAkKyRzSz 6SlSLpiCaveWZw80aGFwCjfi1bGgdp7snhNA2lDNvzsLZ9AKU8TCcA+sDvuNWs35YNk4 Rp/Q1oeCOmYEmBEn4e7qBpW36mhgE6aaIdPM+zhXmq2XdhMEVkKpo+w88dXbg4lsaVbN b3Xw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="R9n/DPM0"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-59382-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59382-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCUi2l5qr+v6WaffTI3bNyXFwEB/C5BwXFITFujt1gPpnKAX0tIGVa27V1czFKZONgShwL6d59OquoZfahR40guU6rVqIQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cd24-20020a056a02079800b005dc556b1defsi928102pgb.485.2024.02.09.05.50.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:50:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59382-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="R9n/DPM0"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-59382-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59382-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1BF61B2499F for ; Fri, 9 Feb 2024 13:46:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29A404596D; Fri, 9 Feb 2024 13:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="R9n/DPM0" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 EC8AF3D0DD; Fri, 9 Feb 2024 13:45:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486357; cv=none; b=iF1L1YOOZFYc/AFsGUwlqZoVooOrQtryezkc8rui6UUUKgSotitYbMGjF0Iz1uDPEP+MS9zOWNuIxCK/BvkGlGHjWq8AztZLIOZ/lTm11idq0t9h2H+AxJbG67jo1sc/w3d7CHMOebfTmUl3GQd5S+uIJjCL2agJIv1VOlOM95M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486357; c=relaxed/simple; bh=Mlu7vr7ccML9k5U1wNxC85TsfulmH0bH6bck85b5lTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MuZUQI5wLrcBq04ZDZW4aWBuWWyxc0QnOlSgdFyw+owgVEHKWHs5EB1/Wvbl/QlYgmzhY3YMHDKvziixW1eIuRZalpe2H/o1fOIDaRFxLeD08o5JP6agolVjc4YwU1JFxkVz/gSApnDx9AhJ793qTY0/sDVjp+mNfawnbbbeG1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=R9n/DPM0; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8AFDBE0008; Fri, 9 Feb 2024 13:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707486353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4SqxWl/i5uX0bLJjW8/zyRNlnWT7m4GMIsHrHc5Dq4Y=; b=R9n/DPM0/Sm2ibKK7ibZ4iCOBEn6TEswhd8v12CdgNiE+4W32JnCSNQMHhOxT4+fNAMvbA +KrWM5HbcwKiqNkRwO4RUoYr0UUS0DbTtWN8Y16qlSSikUPIiCpUh6ma2nyaNFrCSFBbOm /gaaWy3qgXga3CVMvFBoSWNlm+l/toSP3wExrhLvl0OfyR95Vsj2Qh38pO2WFJ+5UXY4/6 p2q+NnLSM63MgbvWIXTmBYvUMVSeYUxWfJR/5MfoFyDhQoyjxj3QvXhHtQfMOnEYywUa0r 7rYLNJfDJ2FLRgMHkl6CBrsEcvr+a4seClejYSX+XYuDwNFBIrM/CxGwv3YAIw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 09 Feb 2024 14:45:30 +0100 Subject: [PATCH 1/4] spi: cadence-qspi: assert each subnode flash CS is valid Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240209-cdns-qspi-cs-v1-1-a4f9dfed9ab4@bootlin.com> References: <20240209-cdns-qspi-cs-v1-0-a4f9dfed9ab4@bootlin.com> In-Reply-To: <20240209-cdns-qspi-cs-v1-0-a4f9dfed9ab4@bootlin.com> To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Dhruva Gole , Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.4 X-GND-Sasl: theo.lebrun@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790429508132164870 X-GMAIL-MSGID: 1790429508132164870 Check each flash CS against the num-cs property from devicetree. Fallback to the driver max supported value (CQSPI_MAX_CHIPSELECT) if num-cs isn't present. cqspi->num_chipselect is set in cqspi_of_get_pdata() to the num-cs devicetree property, or to CQSPI_MAX_CHIPSELECT if num-cs is not set. Signed-off-by: Théo Lebrun Reviewed-by: Dhruva Gole --- drivers/spi/spi-cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index d44a0c501879..7ba4d5d16fd2 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1635,7 +1635,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi) return ret; } - if (cs >= CQSPI_MAX_CHIPSELECT) { + if (cs >= cqspi->num_chipselect) { dev_err(dev, "Chip select %d out of range.\n", cs); of_node_put(np); return -EINVAL;