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=1796409310; b=NMfs0P1aR4JOPQGmu2ixneKp5u0UpmAYyJLmu6QsqcC9BTnJqmxAK2mj/EygGDGp2EsN QK3IlaS8EAzV28ct3qfXagRxIN+03Q62NxLo1ZI/PQ33VzXNo/s2hDTOxiD0vIdjn7uYs td+iwnmKsQWUz4yHvRl47ERVn76ZMPllWMlda9mKEkQUDMfPwCxYMOVdyJZfvR88CKibd G/2mkuBVEPeRd3qEEknY1QdSJ+8a31hJbD/FPMIlNdxSJ7WiFn1wa0d3d9YH6gUxX0te7 RR9b6fRcS0iHN4WybrZdKhlhxKwNGKQgbebZVfkUuQ4bYTg/0azeXwQnC54Z0CJI+wg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796409310; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=yaZoFpzfhWjjvwmGNOLvqSulLOabCZPBXgxvaycNcJs=; b=0Woem2rdAicLst07vL1opJ2j+KNOe8LTQcxRRlr1+9XJrSPAJV4s+/yJ+iTWyuKoqPBR BiCw57KGsGWAxLreDdxrqcL25KGHvqXc6HHM0ijQpUnhcDR8FNnPGRWVZwditqqv3fCdc L3f7eGURzcoToWQNRIRqRhTBq6NKauFGuHpXhlKOzxvr/JLm2o/AIop73hG3GGITxMFyW mOZYDfKhvtTvng5EGVu20Ck0GMQCXyzZL1WJEsFbQiEGEq2hDseQGGMJGeTIGex7W4ICX mOEy7GDrcXOko0Akx7PvmtREeV67n0dvxeNt/1H+l5no7fcMF9Gbxj2H9suexHnrJpA== 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=hIQA5VD8; 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 9E16D606A322 for ; Fri, 4 Dec 2026 18:35:10 +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=hIQA5VD8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D25CE1F00A11; Fri, 4 Dec 2026 18:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796409309; bh=yaZoFpzfhWjjvwmGNOLvqSulLOabCZPBXgxvaycNcJs=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=hIQA5VD88O/PbglwGjxKQjLIaRDGCfp6ERZHMROcGzF502hCcKYawv6Gc2fbenC+a jCP542h+Rnf5VpoVZ4FaG+wUph53Z0KiP5+XRt/nIPJ+zXMPkC7qUo/ydFRIX4V2PX FKiTJkCDMn93+PB0QcSw+s6tYYLH3vkMhtgOhRHddMm9t/rTZ0I1wzfD862b39y0Fi khicX1LwOiQ4/hA2/wB98f7ipIjTclRFHqVkN5Wi/XptdRYp6tQEx5jBRImDuGmBbT eak4Q+Rqe7FB4AGwrPop08n8lPjAqMjw9U/y10utXYylD3KGPLSFCtIZTaNSU9zC1y 4+OFZnRHMb+qw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word() Reply-To: sashiko-reviews@lists.linux.dev To: "Yazen Ghannam" , linux-pci@vger.kernel.org In-Reply-To: <20261204181556.1418843-3-yazen.ghannam@amd.com> References: <20261204181556.1418843-1-yazen.ghannam@amd.com> <20261204181556.1418843-3-yazen.ghannam@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 18:35:09 +0000 X-Mailing-List: linux-pci@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 1 potential issue to consider: - [Medium] PCI: pci_clear_and_set_config_word() ignores pci_read_config_word() error -- commit 6deeae1d914f6910d535248cb7317e53525dce50 Author: Yazen Ghannam PCI: Add pci_clear_and_set_config_word() This commit adds pci_clear_and_set_config_word() to drivers/pci/access.c and declares it in drivers/pci/pci.h for internal PCI core use. > diff --git a/drivers/pci/access.c b/drivers/pci/access.c > index b123da16b63ba..38619bc9c7f91 100644 > --- a/drivers/pci/access.c > +++ b/drivers/pci/access.c > @@ -613,6 +613,17 @@ int pci_write_config_dword(const struct pci_dev *dev= , int where, > } > EXPORT_SYMBOL(pci_write_config_dword); > =20 > +void pci_clear_and_set_config_word(const struct pci_dev *dev, int pos, > + u16 clear, u16 set) > +{ > + u16 val; > + > + pci_read_config_word(dev, pos, &val); > + val &=3D ~clear; > + val |=3D set; > + pci_write_config_word(dev, pos, val); > +} [Severity: Medium] Should pci_clear_and_set_config_word() check the return value of pci_read_config_word() before writing back? When bus->ops->read() fails transiently (for example, dw_pcie_rd_other_conf() returning PCIBIOS_SET_FAILED), PCI_OP_READ() populates val with 0xffff via PCI_SET_ERROR_RESPONSE(). Because pci_write_config_word() only skips the write when pci_dev_is_disconnected(dev) is true, a succeeding write programs (0xffff & ~clear) | set into the register, setting all unmasked bits to 1 and clearing any RW1C bits in that word. Sibling helpers such as pcie_capability_clear_and_set_word_unlocked() check the read return value and abort before writing. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204181556.1418= 843-1-yazen.ghannam@amd.com?part=3D2