Skip to content

Commit 1bed3b8

Browse files
trettergregkh
authored andcommitted
drm/debugfs: fix plain echo to connector "force" attribute
[ Upstream commit c704b17 ] Using plain echo to set the "force" connector attribute fails with -EINVAL, because echo appends a newline to the output. Replace strcmp with sysfs_streq to also accept strings that end with a newline. v2: use sysfs_streq instead of stripping trailing whitespace Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tretter@pengutronix.de Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 459863b commit 1bed3b8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/drm_debugfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf,
265265

266266
buf[len] = '\0';
267267

268-
if (!strcmp(buf, "on"))
268+
if (sysfs_streq(buf, "on"))
269269
connector->force = DRM_FORCE_ON;
270-
else if (!strcmp(buf, "digital"))
270+
else if (sysfs_streq(buf, "digital"))
271271
connector->force = DRM_FORCE_ON_DIGITAL;
272-
else if (!strcmp(buf, "off"))
272+
else if (sysfs_streq(buf, "off"))
273273
connector->force = DRM_FORCE_OFF;
274-
else if (!strcmp(buf, "unspecified"))
274+
else if (sysfs_streq(buf, "unspecified"))
275275
connector->force = DRM_FORCE_UNSPECIFIED;
276276
else
277277
return -EINVAL;

0 commit comments

Comments
 (0)