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 2469A1DFDB3; Wed, 6 Nov 2024 13:02:51 +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=1730898171; cv=none; b=B6FAlhaXAi3Y9i5qjJmaTtTtWp8PIhr/WrsMxYc4vkPlogVFbUG+uwWCOD1MIr+KGSg/pOe9HzZA3kpf0EhIuMrMdjKtcP8efYr3RiOdHOjD0Tj9KAf6jeL5OIBacAN9XnHH76OIycL2pk6ZGsQwAU4kLeP6YIrILo3lMcPH4NM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730898171; c=relaxed/simple; bh=/+0JMurz63sAElEaQNxnu3ehbQLBYnYxUd/BeR85Bws=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RTrssE8sCOpSyEhDWv3Y+1NQaBpw7t4ON2gcMtqtTD20Jtur8D+6pR08c50Ky6EIZ8S9TMyQuwpK8ZzefFn8DlpwxDUt8KqPDJe1XT5kOeX8t1t6DLmRyCyHmCYUxedQWcP6fM9dyNhzJs3w8VY0tAzyi3Lhp07qBfGau4ItKrI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HZHW8rZb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HZHW8rZb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0EC1C4CECD; Wed, 6 Nov 2024 13:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730898171; bh=/+0JMurz63sAElEaQNxnu3ehbQLBYnYxUd/BeR85Bws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZHW8rZbGNWmAmPgoX0cUlz+L20jFeL3djFeMBckAmLcLtQ5HC70LOgpz139r8GVo AKkZaoOIHnYCR5ydB8hO23l/x5WkwyYi8IuVaXSY08ni5n0uqvSlpk2ErEEdvuqbNj E+kcQR4Qj9/agJAMpCXPp4ZFoalVRg/X6ph93rUU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Siddharth Vadapalli , Sasha Levin Subject: [PATCH 5.4 111/462] PCI: keystone: Fix if-statement expression in ks_pcie_quirk() Date: Wed, 6 Nov 2024 13:00:04 +0100 Message-ID: <20241106120334.247373651@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120331.497003148@linuxfoundation.org> References: <20241106120331.497003148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 6188a1c762eb9bbd444f47696eda77a5eae6207a ] This code accidentally uses && where || was intended. It potentially results in a NULL dereference. Thus, fix the if-statement expression to use the correct condition. Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)") Link: https://lore.kernel.org/linux-pci/1b762a93-e1b2-4af3-8c04-c8843905c279@stanley.mountain Signed-off-by: Dan Carpenter [kwilczynski: commit log] Signed-off-by: Krzysztof WilczyƄski Reviewed-by: Manivannan Sadhasivam Reviewed-by: Siddharth Vadapalli Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pci-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index a16fe2a558c7a..b28d3c4205fe4 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -595,7 +595,7 @@ static void ks_pcie_quirk(struct pci_dev *dev) */ if (pci_match_id(am6_pci_devids, bridge)) { bridge_dev = pci_get_host_bridge_device(dev); - if (!bridge_dev && !bridge_dev->parent) + if (!bridge_dev || !bridge_dev->parent) return; ks_pcie = dev_get_drvdata(bridge_dev->parent); -- 2.43.0