From 3825ce5a9bb6ac1f847828ba2b283c9c7aa77eb6 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 27 Aug 2013 14:28:03 +0300 Subject: [PATCH] OMAPDSS: fix WARN_ON in 'alpha_blending_enabled' sysfs file The code handling 'alpha_blending_enabled' sysfs file contains WARN_ONs in case the feature is not supported on the current platform. Even though only root can write to the file, anyone can read it, thus causing the kernel to get tainted and printing an ugly warning. Instead of having WARN_ONs, return a proper error if the feature is not supported. Signed-off-by: Tomi Valkeinen Reported-by: Russell King - ARM Linux --- drivers/video/omap2/dss/manager-sysfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/omap2/dss/manager-sysfs.c b/drivers/video/omap2/dss/manager-sysfs.c index de7e7b5b1b7c..37b59fe28dc8 100644 --- a/drivers/video/omap2/dss/manager-sysfs.c +++ b/drivers/video/omap2/dss/manager-sysfs.c @@ -285,9 +285,10 @@ static ssize_t manager_alpha_blending_enabled_show( { struct omap_overlay_manager_info info; - mgr->get_manager_info(mgr, &info); + if(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)) + return -ENODEV; - WARN_ON(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)); + mgr->get_manager_info(mgr, &info); return snprintf(buf, PAGE_SIZE, "%d\n", info.partial_alpha_enabled); @@ -301,7 +302,8 @@ static ssize_t manager_alpha_blending_enabled_store( bool enable; int r; - WARN_ON(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)); + if(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)) + return -ENODEV; r = strtobool(buf, &enable); if (r) -- 2.20.1