From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796472191; b=ayxmsYMCn3cvRi3H4KsmrYliLMcGXfCT96qUSbpzdm4MDuTjV7ZgbrRsj/wLWkzPg0Uc R+WfezBvCcp09F/Btskklg9k0KX3VkzhxfqySdp9Xn882t3LFMOYsC/6vml3ivJ2gvOaV /QheEQ+G+T7sMI73X9UFG3phAvwJ7q44xZ1+J2IOBZvJZxdMyWnsqibtKR5QibxblkGTD 1qtIVBCMuPSHSpwmruifHLQxlBwwwc1nYnm9IK/oWRHQ8C/KRh0V7Q5LvBa1cYikiiHDu RjHUx2LPkcShXJ7it28k0iVfNvgpdPE1hUxLj40EcO/gn2GDMf9YLG/9IgdqoqU0n0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796472191; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=TfRUkj/3sF8NBARlTsImaGFCNm09CRERTB/d2qwV5FU=; b=ukjpn8W34mJUjVAmhUVkiG290Jo5OhlVQ/vlDiMn/hzrTRzNQ7lPKRIwAS8IQ9Sow6Lv /20kJB03rNX6AhnwOWw2mxxxqS0aRkUw0Svf9Dz6umullrLefe0yXk6vkpV7lL8GF42mo see/q0u3vveDz4WfmJqtYQRT6XSPLkawxuDD+iNp/A7sWHGdFnblbmMj2AypvcEWUoSJq ptSKCfLz7w1pZh0ulW2WKQlm2J+0GicENXCD73PXW3yUC2sH6A6nxm/bzsD+H7gxEIb2E t/cgQ0wYi3/gFs2+AzUoBludNt1n0p+jUnOn3P9cpn1qpPT26XqNqt3kyFwdx/sfHJw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dryEQeN0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA259606A322; Sat, 5 Dec 2026 12:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dryEQeN0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D01D1F00936; Sat, 5 Dec 2026 12:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796472191; bh=TfRUkj/3sF8NBARlTsImaGFCNm09CRERTB/d2qwV5FU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=dryEQeN0JgoFKPSk4bu8JnhxdMD7ODiGTEEB6RlPMH1W5MVedqvqo6U2X/Y1nEnyN Qe6+q7OGk8mw38jUzhtm8smldWFsXwFWerulZabITNxsjsL3rklOm4rp+xksxZsgEs B7uCZ3Vu8cX2NN28GVjIm5P7IeLOvHWdoC0xf85+Mp5qsMLNp+hfLGiXeTp4eKSHc6 GqgVpt6tABFFYTXXeM6WZAePric7oqPGTL2uc8sZGYtavNAybRuTeH1FdCO61Q9pD7 nbnU+FuOkwGBedAsrnMGoM7hK4p+FbS/sfWfJ6t8US2XiZ6ERkqJukcMG0wDvcx0EK BWRnw/imjNsMQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 4/5] mfd: ocelot: Add support for the LAN9645x switch family Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?SmVucyBFbWlsIFNjaHVseiDDmHN0ZXJnYWFyZA==?= Cc: mfd@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, lee@kernel.org In-Reply-To: <20261204-mfd-ocelot-add-lan9645x-support-v2-4-d0b811aebfbf@microchip.com> References: <20261204-mfd-ocelot-add-lan9645x-support-v2-0-d0b811aebfbf@microchip.com> <20261204-mfd-ocelot-add-lan9645x-support-v2-4-d0b811aebfbf@microchip.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 12:03:11 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] mfd: ocelot: duplicate LAN9645x GCB regmap due to resource name mismatch - [Low] mfd: ocelot: data race on spi_padding_bytes in ocelot_spi_probe() -- commit 3668fbd43fcd3e9655859afe6d486c660c2336eb Author: Jens Emil Schulz =C3=98stergaard mfd: ocelot: Add support for the LAN9645x switch family This commit adds MFD and SPI regmap support for the LAN9645x switch family, including chip reset handling, SPI padding byte calculation around reset, and child MFD cell definitions. > diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c > index b02f8a5eaab92..eb040be912048 100644 > --- a/drivers/mfd/ocelot-spi.c > +++ b/drivers/mfd/ocelot-spi.c [ ... ] > @@ -50,6 +57,10 @@ static const struct resource vsc7512_gcb_resource =3D > VSC7512_CHIP_REGS_RES_SIZE, > "devcpu_gcb_chip_regs"); > =20 > +static const struct resource lan9645x_gcb_resource =3D > + DEFINE_RES_REG_NAMED(LAN9645X_GCB_RES_START, LAN9645X_GCB_RES_SIZE, > + "devcpu_gcb"); > + > static int vsc7512_spi_padding_bytes(u32 max_speed_hz) > { > if (max_speed_hz <=3D 500000) [Severity: Low] Does naming lan9645x_gcb_resource "devcpu_gcb" cause a duplicate regmap for the GCB block? lan9645x_switch_resources defines the same GCB range under the name "gcb". Because ocelot_core_try_add_regmap() deduplicates by resource name via dev_get_regmap(dev, res->name), every LAN9645x probe creates a second regmap and debugfs entry for the same registers. Naming lan9645x_gcb_resource "gcb" would let ocelot_core_try_add_regmap() reuse the regmap created in ocelot_spi_probe(). [ ... ] > @@ -266,6 +306,8 @@ static int ocelot_spi_probe(struct spi_device *spi) > * This must be done before calling init, and after a chip reset is > * performed. > */ > + ddata->spi_padding_bytes =3D reset_padding ?: padding; > + > err =3D ocelot_spi_initialize(dev); > if (err) > return dev_err_probe(dev, err, "Error initializing SPI bus\n"); > @@ -278,6 +320,8 @@ static int ocelot_spi_probe(struct spi_device *spi) > * A chip reset will clear the SPI configuration, so it needs to be done > * again before we can access any registers. > */ > + ddata->spi_padding_bytes =3D padding; > + > err =3D ocelot_spi_initialize(dev); > if (err) > return dev_err_probe(dev, err, "Error initializing SPI bus after reset= \n"); [Severity: Low] Can updating ddata->spi_padding_bytes here race with concurrent regmap reads from debugfs? ocelot_spi_init_regmap() exposes the regmap's debugfs registers file via devm_regmap_init() before probe finishes. A concurrent root read of that file calls ocelot_spi_regmap_bus_read() under map->mutex, while probe writes ddata->spi_padding_bytes without that lock or WRITE_ONCE(): CPU0 CPU1 ocelot_spi_probe() ocelot_spi_init_regmap() devm_regmap_init() regmap_debugfs_init() regmap_read_debugfs() regmap_read() ocelot_spi_regmap_bus_read() ddata->spi_padding_bytes =3D ... if (ddata->spi_padding_bytes) <-- data race This causes a data race on ddata->spi_padding_bytes and transiently mismatched SPI padding for the debugfs read, especially while ocelot_chip_reset() sleeps. Initializing spi_padding_bytes before ocelot_spi_init_regmap() and using WRITE_ONCE()/READ_ONCE() or the regmap lock avoids the race. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-mfd-ocelot= -add-lan9645x-support-v2-0-d0b811aebfbf@microchip.com?part=3D4