Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2652784pxa; Mon, 17 Aug 2020 15:35:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJm18FJ6yzMgFN4qbSa9jgetWChs5ZbOn9bAaNJVdmO3yS2Jd/ccNY9NRqo57uBktMNLt6 X-Received: by 2002:a17:906:868d:: with SMTP id g13mr17073090ejx.242.1597703704701; Mon, 17 Aug 2020 15:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703704; cv=none; d=google.com; s=arc-20160816; b=JBWdaU59vYojqXpcXSUA3SSbrsO5Bh6XQOZyLzLX0VbtrWzV48utEZ1dp8RGOrkvI7 v3ri7MTDcDL8P7+yaUMV4gTaC4dr7WTgi3Ea85sYbpx5cBtRd2U3L4gv5dYcmZwXsC5F VvqFTFqxieNau3f98AM446V1Do5tf6tiv2XsxyZtXv+ZAtO+TI3yPcttQcmYeCyqBY9I RICx/Xv6a01budpCWlfB38wPdjjwvltbpkWoWaxUZW9NM0UXDhnw/GDnl1DE+jfsK1sc aT0qRNRmux8eBdTkHhRrl6MvxCJPt93nTzS6AArEovZhsTg44uPSic0A5r6feOcQ8AKM tbRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UNEeypRz6HXaCTENfHhsDb7vLK5F8yK4bRbJGsiZjQw=; b=MU41hfZmVttvvY3Nwe38P5Gy6BIxIEyQupO7WKxkfOn4QQHrKi43yX+xbk6ZEQf6Jg sOgReX72w5EYAGry7VOH2o98ZFrfK6fvk2sDM7oxdVc1o4I7XTHGmdMMsz/rISlFSdkt 747HwPcHJsDZDOQTctpQJV/ARvkQJGrrhPljjWVxG2Hri4EgYO9YXRml/3bWlK4NmuB8 glH8njNsAnPyfyuJ9yUMNxW7EyaPaX35x2VtBtW+qmMpjPybgXvy4Kq0aLYT4OCMqChe wU4SoFsb0DzkzPLJmu7Ka5sOVN0y8ZLujnRGaLh6SIBZcX+2B4NPkqlyfIoLAyk+yjz/ hguA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kdRneImz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y102si7928822ede.258.2020.08.17.15.34.41; Mon, 17 Aug 2020 15:35:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kdRneImz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389589AbgHQRQV (ORCPT + 99 others); Mon, 17 Aug 2020 13:16:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388756AbgHQQNk (ORCPT ); Mon, 17 Aug 2020 12:13:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 189A820578; Mon, 17 Aug 2020 16:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680818; bh=yzqgOeGUuulbsB4LN8mlMYgkUV39h4cYOiRjSlgDeqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdRneImz2oTXvMJHlvMfKpp66MAuYI/dqd0ec4+tqlM5uzvT8lBMROpIQyuaVcniM i0XierI7FelDEvq9fzeDfShWwcKm8hlP/UAhfjY3PhWXb7wTN9uNmzhbn+RWTXGrFx 6mXdqdB20BKPfrW0tS7ZxWJLxSaeE/l2M6QCQWiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Tretter , Jani Nikula , Emil Velikov , Sasha Levin Subject: [PATCH 4.19 039/168] drm/debugfs: fix plain echo to connector "force" attribute Date: Mon, 17 Aug 2020 17:16:10 +0200 Message-Id: <20200817143735.731694115@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Tretter [ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ] 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 Reviewed-by: Jani Nikula Signed-off-by: Emil Velikov Link: https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tretter@pengutronix.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 373bd4c2b698b..84b7b22a9590a 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -265,13 +265,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf, buf[len] = '\0'; - if (!strcmp(buf, "on")) + if (sysfs_streq(buf, "on")) connector->force = DRM_FORCE_ON; - else if (!strcmp(buf, "digital")) + else if (sysfs_streq(buf, "digital")) connector->force = DRM_FORCE_ON_DIGITAL; - else if (!strcmp(buf, "off")) + else if (sysfs_streq(buf, "off")) connector->force = DRM_FORCE_OFF; - else if (!strcmp(buf, "unspecified")) + else if (sysfs_streq(buf, "unspecified")) connector->force = DRM_FORCE_UNSPECIFIED; else return -EINVAL; -- 2.25.1