[PATCH] drm: fix writing to /sys/class/drm/*/status

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Jun 5 12:24:00 PDT 2015


On Fri, Jun 05, 2015 at 07:56:38PM +0100, Chris Wilson wrote:
> On Fri, Jun 05, 2015 at 07:47:22PM +0100, Russell King wrote:
> > Writing to a file is supposed to return the number of bytes written.
> > Returning zero unfortunately causes bash to constantly spin trying
> > to write to the sysfs file, to such an extent that even ^c and ^z
> > have no effect.  The only way out of that is to kill the shell and
> > log back in.  This isn't nice behaviour.
> > 
> > Fix it by returning the number of characters written to sysfs files.
> > 
> > Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
> 
> Oops.
> 
> Fixes: c484f02d0f02fbbfc6decc945a69aae011041a27
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> 
> Dave, we need this for 4.1...

Viro suggests an alternative, simpler fix:

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index ffc305fc2076..eb7e61078a5b 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -217,7 +217,7 @@ static ssize_t status_store(struct device *device,
 
 	mutex_unlock(&dev->mode_config.mutex);
 
-	return ret;
+	return ret ? ret : count;
 }
 
 static ssize_t status_show(struct device *device,

Would you prefer this one?

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


More information about the dri-devel mailing list