Commit 5f0d9840 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Javier Martinez Canillas

drm/armada: Fix off-by-one error in armada_overlay_get_property()

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: c96103b6 ("drm/armada: move colorkey properties into overlay plane state")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a4d779d954a7515ddbbf31cb0f0d8184c0e7c879.1689600265.git.geert+renesas@glider.be
parent c9155a3c
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* Rewritten from the dovefb driver, and Armada510 manuals. * Rewritten from the dovefb driver, and Armada510 manuals.
*/ */
#include <linux/bitfield.h>
#include <drm/armada_drm.h> #include <drm/armada_drm.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
...@@ -445,8 +447,8 @@ static int armada_overlay_get_property(struct drm_plane *plane, ...@@ -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_ug,
drm_to_overlay_state(state)->colorkey_vb, 0); drm_to_overlay_state(state)->colorkey_vb, 0);
} else if (property == priv->colorkey_mode_prop) { } else if (property == priv->colorkey_mode_prop) {
*val = (drm_to_overlay_state(state)->colorkey_mode & *val = FIELD_GET(CFG_CKMODE_MASK,
CFG_CKMODE_MASK) >> ffs(CFG_CKMODE_MASK); drm_to_overlay_state(state)->colorkey_mode);
} else if (property == priv->brightness_prop) { } else if (property == priv->brightness_prop) {
*val = drm_to_overlay_state(state)->brightness + 256; *val = drm_to_overlay_state(state)->brightness + 256;
} else if (property == priv->contrast_prop) { } else if (property == priv->contrast_prop) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment