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 8327A2F619D; Thu, 15 Jan 2026 17:44:47 +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=1768499087; cv=none; b=eUOclEFZtXRNX6TYDGDDpsLp28ClgW7cZ1BAFjVZT5AGyKZJz/oYDw6KtRSzxUXNgh5M07AAkbBBjGngVZpGDAKe9TbPMrAh/53eW7vjVi0wtvvrJvGVnfcG50wIwYBqcwIeCDNnXe93bEiAhsNT0X/6BLsZBM6WXFIM9pU9b6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499087; c=relaxed/simple; bh=/MdwmH3OiAEeolBRsVUwQMZTLFrEG8TESGZvNxa0pjA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uwbQnMeF8iI5cgRidv22ecEcT2tQa8U13QAe9jZYMZsIu/K1XdZtYY6K/Ga0eH3EP0f3Uzo1AgGO6FPxaZYpcaVW6QmfBAOxV6febe1mDPzXaOvh50qhJfPfB7NPKLK3QKsmZB3LkX6YBtCD1aaa+ukThQns3cnjIPobiqbXWvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SnEHx71V; 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="SnEHx71V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB0C1C116D0; Thu, 15 Jan 2026 17:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768499087; bh=/MdwmH3OiAEeolBRsVUwQMZTLFrEG8TESGZvNxa0pjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SnEHx71V6Eny9mg8nRKQe+FIj/6l8VTAWvu4g9pfjwcDoq/dSbpL7Zwmty2MEj+0S +NwRg/CyexaRLKYO5p8tBCMTeMPAnabNLFkjj+ySCT+JUp/wz/5EUWxdwd29uMo9UD 3gKmellKW2zevxwmVqKtgSBJE28/UJRf+TNMbrC8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Alex Hung , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 104/451] drm/amd/display: Fix logical vs bitwise bug in get_embedded_panel_info_v2_1() Date: Thu, 15 Jan 2026 17:45:05 +0100 Message-ID: <20260115164234.680041933@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164230.864985076@linuxfoundation.org> References: <20260115164230.864985076@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 1a79482699b4d1e43948d14f0c7193dc1dcad858 ] The .H_SYNC_POLARITY and .V_SYNC_POLARITY variables are 1 bit bitfields of a u32. The ATOM_HSYNC_POLARITY define is 0x2 and the ATOM_VSYNC_POLARITY is 0x4. When we do a bitwise negate of 0, 2, or 4 then the last bit is always 1 so this code always sets .H_SYNC_POLARITY and .V_SYNC_POLARITY to true. This code is instead intended to check if the ATOM_HSYNC_POLARITY or ATOM_VSYNC_POLARITY flags are set and reverse the result. In other words, it's supposed to be a logical negate instead of a bitwise negate. Fixes: ae79c310b1a6 ("drm/amd/display: Add DCE12 bios parser support") Signed-off-by: Dan Carpenter Reviewed-by: Alex Hung Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 9dd41eaf32cb5..3cc61bb6f8967 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -961,10 +961,10 @@ static enum bp_result get_embedded_panel_info_v2_1( /* not provided by VBIOS */ info->lcd_timing.misc_info.HORIZONTAL_CUT_OFF = 0; - info->lcd_timing.misc_info.H_SYNC_POLARITY = ~(uint32_t) (lvds->lcd_timing.miscinfo - & ATOM_HSYNC_POLARITY); - info->lcd_timing.misc_info.V_SYNC_POLARITY = ~(uint32_t) (lvds->lcd_timing.miscinfo - & ATOM_VSYNC_POLARITY); + info->lcd_timing.misc_info.H_SYNC_POLARITY = !(lvds->lcd_timing.miscinfo & + ATOM_HSYNC_POLARITY); + info->lcd_timing.misc_info.V_SYNC_POLARITY = !(lvds->lcd_timing.miscinfo & + ATOM_VSYNC_POLARITY); /* not provided by VBIOS */ info->lcd_timing.misc_info.VERTICAL_CUT_OFF = 0; -- 2.51.0