Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4521179rwb; Mon, 21 Nov 2022 08:33:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pE+UkXhKlJXC56s9hV7jhUjI6P3Rx3pHIRrPeIZrtZX/pgbi8owZEjmdiajJOUj62sndW X-Received: by 2002:a17:902:aa43:b0:17f:52af:d022 with SMTP id c3-20020a170902aa4300b0017f52afd022mr12541648plr.122.1669048396759; Mon, 21 Nov 2022 08:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669048396; cv=none; d=google.com; s=arc-20160816; b=rFO2i0nxMtraXh41X1VvN6sTM/ibC2ZzVoKiXgtE+dJz8LFWC9Lde0+X2R3gurcINY 7FsradUBoQhdmUyZtvcnBkcSGKdoPFHe6etHPsFc/3Cnt9Sv050xbq5m+tgIu1WMHcmk VAH2qESrnCMD/r9fz/kD+TSOOLWe/YlnxTQZYzF2tY8Zi8cI5ngL6K25YbTnzDjQVjt3 BLAyagoQLtzSoDijLArrS42t2PNDlyhqK1wTgpZyF21vuwJ6QZCozM6Ld196/NJkTFT+ ucGZhbGy2IgPkht4Pfcmcy1d7OMoXad+1sUz+mwySlwQqL7Vrdc2W7ZfSH/FImbNieue t1fQ== 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=IhEb1PgX4thAk4W281yAm1mc+9lCxzzZiRX+rL1bfVk=; b=o9++cZmd3lXVzQIoNOQkDDuRXNmE/5vwjoajP9TSs+TdcNksh8jrZAMj7xv6DpESgp 0ix1v+RWlNSQygYCNpo2/f8HkUXTAqSJiIhy/Z29Nryay/IplRClSBoemlbyFV/rNvUi Dxx5r/PcFZZ8P6QFslJN8Bomb8xwA4L7d2ACKMsRMbrNxJSCBsMzA5/Sj//Mz+evjQF5 ROrUEXDoBfEJp407ZoeCoTAsw2gmGFZPQwPPTH450SMBpU6a0BMK/Af8GVKclegCzG00 V43ZY4WNPCwf1cr9f4WRHbUVA7Pi+LcxYVhwo8MOtDzap5EaojicuBarxUH66RyA4+fx vheg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a170902a51000b00176b7e66c9asi9986819plq.155.2022.11.21.08.33.04; Mon, 21 Nov 2022 08:33:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbiKUPoH (ORCPT + 91 others); Mon, 21 Nov 2022 10:44:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbiKUPne (ORCPT ); Mon, 21 Nov 2022 10:43:34 -0500 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87030E0EC for ; Mon, 21 Nov 2022 07:43:18 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed10:4821:1ba5:2638:5c3a]) by laurent.telenet-ops.be with bizsmtp id n3jG2800Y5WXlCv013jGTk; Mon, 21 Nov 2022 16:43:17 +0100 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 1ox8x2-0019F9-Al; Mon, 21 Nov 2022 16:43:16 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1ox8x1-00BQNV-MS; Mon, 21 Nov 2022 16:43:15 +0100 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 resend] drm/armada: Fix off-by-one error in armada_overlay_get_property() Date: Mon, 21 Nov 2022 16:43:14 +0100 Message-Id: <788e97ac9b2aeee1941f274bf7b279b68c7592b6.1669045360.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 f21eb8fb76d87285..3b9bd8ecda137f6d 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 @@ -445,8 +447,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