Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2558202pxb; Fri, 29 Oct 2021 04:01:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7iIGPKokhg0vAWFaHHkLSRBrK5NVnMOonZUI+qBp8zlPRHAZ20uPktACtX7PIiPBY8PSB X-Received: by 2002:a17:90b:1a87:: with SMTP id ng7mr19277764pjb.69.1635505268902; Fri, 29 Oct 2021 04:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635505268; cv=none; d=google.com; s=arc-20160816; b=AuIQnpGb4ZLikBKuEoLDCYG3PcoQzePA/6zt3eoxwi4mXGLSb3G/UAKUy0GBAm5W9o FhiDwTl5hxy/FtB01Yggl4tuiv9GXRUMbv4VLrYZ4W+SDZEBgnrrWWpNoEROS8bhq/hM 3Wgwl5SUdIDKKKQshRB0Ip2u+pPEHwvyKnFomYO0+VpgWXr0YBzEOrVjA4nllr5kYd7J sOpdBV0uWui2B+JvdPodSRwHgh6qsyauYyEEs3Fc65Z+MMTzT0/PyB6jCU7PcB1GWJ60 An26uouF7QDCcJUpbNqdVSmsUbncMjrnMssKSzS6MjDhyOKlyPKqKlAbyfgLuD+dSPQk QNNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bDfVMQCqRvYSEMl8CL89UdcZXDMCaFrNfoLcyMAw2cw=; b=XROTf+dgTiv7VoiJmGlZZhBWALUclM21g8rOIhtukNxZCCW1Q9UNHttzmA4XzHearp zoHH+EtZQZhVtOEBw78Mze6jz6Q0H/gM/bZdA94hBbjJRRj1ml5mC1fkI218kOvVKqvA u72M+O24BgcrtLgiNL/zgvHrwXIoRjVtySTDRiw1LSxUU7/x+NNGi8/4fO5CyCDdparP GRGpUomISer9eGOqtn+7ldtZ1ls5v/UufPZwLPezUDAh43AS2W95fo5Mp1mmxJcOS5UW Py/n1EWkToR+UJBKReV6o0WyRIDUmwtqR9sZjkyjuvgArBBXl5OiFhYklHB8TkIQtBep c0Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a26si7614716pgm.58.2021.10.29.04.00.48; Fri, 29 Oct 2021 04:01:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231740AbhJ2LCH (ORCPT + 99 others); Fri, 29 Oct 2021 07:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231821AbhJ2LCF (ORCPT ); Fri, 29 Oct 2021 07:02:05 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2928C061714 for ; Fri, 29 Oct 2021 03:59:36 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:20b9:ea2a:8e1c:8da1]) by andre.telenet-ops.be with bizsmtp id BmzY2600i01kgUz01mzYpo; Fri, 29 Oct 2021 12:59:33 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mgPbg-008ir7-KN; Fri, 29 Oct 2021 12:59:32 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1mgObF-00FChw-47; Fri, 29 Oct 2021 11:55:01 +0200 From: Geert Uytterhoeven To: Russell King , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] drm/armada: Fix off-by-one error in armada_overlay_get_property() Date: Fri, 29 Oct 2021 11:54:42 +0200 Message-Id: <5818c8b04834e6a9525441bc181580a230354b69.1635501237.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As ffs() returns one more than the index of the first bit set (zero means no bits set), the color key mode value is shifted one position too much. Fix this by using FIELD_GET() instead. Fixes: c96103b6c49ff9a8 ("drm/armada: move colorkey properties into overlay plane state") Signed-off-by: Geert Uytterhoeven --- Compile-tested only. --- drivers/gpu/drm/armada/armada_overlay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index 424250535fed9e87..0383deb970bbbb03 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -4,6 +4,8 @@ * Rewritten from the dovefb driver, and Armada510 manuals. */ +#include + #include #include #include @@ -451,8 +453,8 @@ static int armada_overlay_get_property(struct drm_plane *plane, drm_to_overlay_state(state)->colorkey_ug, drm_to_overlay_state(state)->colorkey_vb, 0); } else if (property == priv->colorkey_mode_prop) { - *val = (drm_to_overlay_state(state)->colorkey_mode & - CFG_CKMODE_MASK) >> ffs(CFG_CKMODE_MASK); + *val = FIELD_GET(CFG_CKMODE_MASK, + drm_to_overlay_state(state)->colorkey_mode); } else if (property == priv->brightness_prop) { *val = drm_to_overlay_state(state)->brightness + 256; } else if (property == priv->contrast_prop) { -- 2.25.1