Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5627414rwp; Mon, 17 Jul 2023 07:11:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCrX4CSB0cOxxq1isXnQmEdpeB99XlcfgezQhgA/We2CnZNQFDPhDRtZsa9/UKgS8g92wi X-Received: by 2002:a92:d1cf:0:b0:347:712c:dc9 with SMTP id u15-20020a92d1cf000000b00347712c0dc9mr9748434ilg.22.1689603065081; Mon, 17 Jul 2023 07:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689603065; cv=none; d=google.com; s=arc-20160816; b=glZsBD3/XNNsNNv79bu3k4GqV6fR0U7uJC4ZRDC85I/oQ+VG1sEQhh3LAFRjoV9aZ7 ZUmji3SW/toVWSYbabYqwtQiWctM6Xb/wLTPP9l/F1GVLXZSqOovExtxwqQYYnzhpG3/ B6HmaZBMJEOaZw2pP17y3e8wPNKhndl9g5do3poTNQO8PhrUnGWJ6TDxrllDqTJNoJgZ heaCsg753QtUJQg6geCJ/jRieWG74179Zs1rGuZMStkDAHFem++K49IQGwy0weA5VrDl UE2SrI6cqywb8TtcoB1kYikB1EZkYeSOptpAZ2voe1Tv0gfoZS/jOUTfqaNpBc3Th6tR TK6w== 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=PB0/S4sqnqT4Ml80LqHsWdiTrTVuNxKA4YlDjRc8bmQ=; fh=3S4GTVz/Du1AnHfEXnVLM7ztIp6/yX5SL3uzMaY2XXs=; b=tlsMZUqL6e7PkDSZdYEq6p3LVfbodqnSsltfcc9KXCvDOHOUVWnk0IS04IoE3W6OlE 5VsYa36RPwhLzpgUydsce2aSFRReMHCghCH+EE6hv71tYbdtvs+3COajv0/n34LB5hV+ 6/wt0e/1oqbOJuN3pC8nZXlXQK0sAwAMEuMhudF+p+uoFyAGyBkpZAbI6oYOmlqNigU1 mz6nk5q5oLW2ufiWmEJLEef2hFnM5W8QHyJJGH5Wvvq19CXXfkBfJT0CtGTnWCFrzHAl 3R/w9H3AQub97Y1wqcyIT0gRWqCJ95WCgLk1hD9ag7AyTvnnTJgfu2TyS9fAj0cAsPya 3lhw== 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 z8-20020a17090acb0800b0025027e0ad3dsi5770213pjt.81.2023.07.17.07.10.52; Mon, 17 Jul 2023 07:11:05 -0700 (PDT) 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 S231720AbjGQN0e (ORCPT + 99 others); Mon, 17 Jul 2023 09:26:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbjGQN0W (ORCPT ); Mon, 17 Jul 2023 09:26:22 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F43D1 for ; Mon, 17 Jul 2023 06:26:01 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:5803:2d6d:5bbc:e252]) by baptiste.telenet-ops.be with bizsmtp id NDRh2A00S0ucMBo01DRhqK; Mon, 17 Jul 2023 15:25:42 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qLOEG-001fvt-Th; Mon, 17 Jul 2023 15:25:41 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qLOEP-007Qxj-Qe; Mon, 17 Jul 2023 15:25:41 +0200 From: Geert Uytterhoeven To: Russell King , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Russell King Subject: [PATCH v2 resend 2] drm/armada: Fix off-by-one error in armada_overlay_get_property() Date: Mon, 17 Jul 2023 15:25:40 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Reviewed-by: Russell King (Oracle) --- Compile-tested only. v2: - Add Reviewed-by. --- 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.34.1