Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp933650rdb; Fri, 9 Feb 2024 05:46:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtR+gsPFPy9JeJeL+ks7Qw0kMWpoFJuQft36n1H9gtaSMJ2GNHHvRnN5kHvrfollTolzlR X-Received: by 2002:a50:fb0b:0:b0:55f:f25e:3339 with SMTP id d11-20020a50fb0b000000b0055ff25e3339mr1433070edq.15.1707486372498; Fri, 09 Feb 2024 05:46:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707486372; cv=pass; d=google.com; s=arc-20160816; b=itrXG16lCSQJnFOtHb1/JZtWsVFe9PQ5iaU7p8rJ8WNHRW1el7MczEDTryqwnKSmyX 3KmvME4o7JYgVi71yXJm1NIm1yBaX5oWIYGKwcBJgyIppT/B/vtKLdIK/unu6upkC9Vo 2hrz9erUahoaSePs4uVGTi5t0gjVMRSyMq/aiqByC6Dlcs+wyeG1fv5X4tTjkls/nTzC M8feVD9A+Hp7mvzm8j1rFqP1P2L/TTgjTka8KfQU03/lGg5vloDn7tpP1kaqUkubgzUm srBMRJaM1ZvwLhWfROkgodnmA12TsOBozVotgyBsS+xk4f9BlSvM66rPx+CDfBG/iWBQ m8DQ== 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=sC/HhD3Vbmyu9dMlWBfeK4tc/LXIUbuhilm+hwmlgdI=; b=qO29TBplbqei1TNLOpQvyRq1H+RIJhWoSoY1TzqIn5Ig/PtDYu8o13rjaH0x+YyVOs fk0Ne2n5RRMH1OnqwBdxbiidgJlnXbzHsOmjbQSFbw0tZ2afGfTXjjSRL1OLRINR7Jkh r4P/oI3tK7Zxzs+o67/UtdDXTKKj7hQyhfyOs3EmE6TnvshoAcUcdjBCe6dwR3Uq/LxB UA68ukexDDDoxx6+Bs+cDmYg7smbAIUfJzfMyL48zkC9D/SrvbaQPJ0ORpUswvEoE2cD GYWpfTXG53ZGxUVIx4Yv+duZR2WTAB/nw652iJphFIiXnhBYD22rnDOQMHguteOp60Uv gLHQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59382-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCWFP5fZB0nnps0jVp+YUu163f6ig9JXcHW4fcm+wVzyEW3gU4Sx19KPn0uMjXC1p915ed27FA/6xi75348PE9CV7gVSTO783UmlZm4i+Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r18-20020aa7da12000000b00560de31cc38si910988eds.198.2024.02.09.05.46.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59382-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59382-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 407921F2483C for ; Fri, 9 Feb 2024 13:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 430043F9CD; Fri, 9 Feb 2024 13:45:58 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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 --- 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; -- 2.43.0