Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2663919pxa; Mon, 17 Aug 2020 15:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy61KpvZPQEhJIqzGqYxsrLhEk7hOpNmtOLM4xZxkSEtFag6KPojUtQq26qBnN9FaRpJsNZ X-Received: by 2002:a17:906:3911:: with SMTP id f17mr18111365eje.56.1597704988980; Mon, 17 Aug 2020 15:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704988; cv=none; d=google.com; s=arc-20160816; b=Z7IRfFekv8b3FGaxFQ6KpIfLEIu1CLoHu45tSzP4iaunCb30nrCf4DDTntQrB8ERaS 2uS9rJJ4BklKd8P2sm+HYomo4ZCdiDXq315JnnsfSQV84WPAXkcV/7dF8TNOn3TKyGeO 6vU7SqgzvpWqIfXMl1OPw6RmaePPtu1J3Uga68zLUmNNuelze8uXHByjcm9sBcet0zo+ ie5UEqlR6gmfsxPO8my8j072zj4IGpiYiQ3zJP07bF3vlHzrRJ0wD4AVBWtZYFKLsdF8 Vi7HR7ZH94Ox8ktQNrpGKt03HSMFn2no8ctNB4eaKKjSJvy2UT4l5iMMSeO7BIbwYdGs kjgw== 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=zdD9cHoEKpWbytPhhTY8mOblRJK9KP8AhBgXMiUsW50=; b=Kr/h4qFvNliWYfsEPr5QstUk6urS6+elqNtTFHL6k77yC/YN5NLazuvGvZHBu5Xw8c 7bYeyTe+D/5UIAY2N1MO3moMvxRBMOj6sJhlEnpsTtVNEwuNCbjTWRWVbLWg3Hhm2OPz vEgAkXo99K5t5njNkJlUxXOp2BlEle2SgITqr6VW0E3uOO0BQHmnYeuUl+rvuA+i/ZA6 Q8P3WHbabeKoSVRZiDC5aShAmnf3nB2lcLUDozoBhGTqKK6Gmh7RoYw/XqNizBzdqshZ F5Vr7Ou9GIjv29zrNgUWy0Tk09FQOFI188e98xyF82NqW/XTxaq77f0+vGWmCQCvbyW2 vTUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rp2FmgRs; 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 z15si11956649eja.112.2020.08.17.15.56.05; Mon, 17 Aug 2020 15:56:28 -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=rp2FmgRs; 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 S1732625AbgHQToQ (ORCPT + 99 others); Mon, 17 Aug 2020 15:44:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729511AbgHQPXB (ORCPT ); Mon, 17 Aug 2020 11:23:01 -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 92C3E20825; Mon, 17 Aug 2020 15:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677781; bh=CaGu3jCShAi6zK9n0jAB+MVmHli5uXnzyL5xTif5KX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rp2FmgRsUo5/TtE75bzMpFGYloBh1P96iozItvGki82C3gaKH0u31xbD9ktRxSOBx rsWE1RWvNXvm38HH0igip1P+Wip4bIcTqGjRtKQlByJSjB3XZVXlRKqPZFq8P36NJg aEO4tNG85GXhysmPRpB6o8f7dHmkxJInaIoM/nDU= 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 5.8 105/464] drm/debugfs: fix plain echo to connector "force" attribute Date: Mon, 17 Aug 2020 17:10:58 +0200 Message-Id: <20200817143838.823807881@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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 2bea221307037..bfe4602f206b4 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -311,13 +311,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