Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3792109pxj; Mon, 7 Jun 2021 21:36:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiDqKIqAcPzH9WFpWC27bzZIbawNL5NUhsi1D8Hc5wqlEp54rOjV9fFGqf4WEK2Y/5rjS3 X-Received: by 2002:a17:907:770a:: with SMTP id kw10mr21371901ejc.213.1623126995758; Mon, 07 Jun 2021 21:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623126995; cv=none; d=google.com; s=arc-20160816; b=JaGWaNJePGaCyjud9QyOFLYRe89pCyBt37XEICtDWFVgdS4yUSzrOZEekohWj7Dir2 gOSDry0iEI9DP0d48XcmTfojNpWAXa6m1bhXOoNnq6tpOeBNO2WdRYXKRHYNQd4AhoNC fy/0YNAKtZeET75fkjrfOWjiFEqY3lx6Yyh/5LgMrCnBsXkYIvT6HPYrHltnhFuzIvIv 7MwPOeuhNa7IQgGYbq6l+ELA/w8eso6Te3OGKSG/4jxl8GG2dQ5Aqzk7LQf1+Ue7nnnh voqTheU8Cai24q/s7UoVvc9YD06wam1COvqLNvG4XuDB4sj9/2Q3JfPuHOZZ5JZXW0Tw yB6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=1CsAHJB1drzJFE9aMs2rQoto13RGg0fVp1ldOeOJhJM=; b=JlYPTYvss0DTa+qf/H4jYfE6cOuOub74rUqiJ8BC1NgzB/uZaFNjKNaCIsbnnJxesd 63f7bgDSgN95MP8jdaL8MGZYXrSFi4voD1CkGuNxToBGJFN7miV6Mr6GNxPoMc+wbBmE Sozy+I0lDbH6OGBk3yJ99DozZsBFKcAuzmOJNj0Wh4qrMrLf3r3xFFqXO/sfeT1uj0xS UTf/ayXcQ9um/q3L4foquZ3LtTfuEG70QnEjBqV7ngYIzQ9d3tkXOsQTeb0Y6weYztvl W/z+nKg/8wgMcAbgH5TWvtHEBVXLCVhmCfZVhTpCpIcdIOgIhNAWSK3h6RE1lCShJNzG DnDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AODPeS3R; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si4084773ejo.733.2021.06.07.21.36.10; Mon, 07 Jun 2021 21:36:35 -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=@google.com header.s=20161025 header.b=AODPeS3R; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbhFHEf4 (ORCPT + 99 others); Tue, 8 Jun 2021 00:35:56 -0400 Received: from mail-yb1-f202.google.com ([209.85.219.202]:43632 "EHLO mail-yb1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbhFHEfz (ORCPT ); Tue, 8 Jun 2021 00:35:55 -0400 Received: by mail-yb1-f202.google.com with SMTP id q63-20020a25d9420000b0290532e824f77cso25374408ybg.10 for ; Mon, 07 Jun 2021 21:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=1CsAHJB1drzJFE9aMs2rQoto13RGg0fVp1ldOeOJhJM=; b=AODPeS3Rxy2dCzZVvlT77V++MmhgHwq/LXwUy62+WDULLkPs3l7t2Y3YlSU2OjGQxR wRSr6oKoRjTEq51NPDaNczweGae+Jm19rFf8p0D5OaFId+n1nPwvgzxFuLh4LXw1S3QA MlDb9Z41YtIo7OVegofT3m75hTP5y4ZKA8kLLhHCTMA3VMmJxMvAugXCIMSbiEfuHiPX l+2sM+hwGu4aP8yjEWplKd/vPOAJeenAlCNz4bOpqFQQmQe5Eiee/FvebF7i5MxXku5F PHbrhdGGqnsemAsDaDo5A53MJ4cVUbzYoHZdk1btN6z0Gl0BwAEeWgU7kEOQooBIeWs0 GOLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=1CsAHJB1drzJFE9aMs2rQoto13RGg0fVp1ldOeOJhJM=; b=DOKq+oemncsX5hMRqDSQMbSsuyZ2BAXfrSJH7YLhY67S1v0XGoRU6poionsx7sS0Lk QPE46G6mRrdz/CjcRYIjN3J3pAUHK8u9EeSEAy2yGsbtAYYABkWfR9FW6omf11+Wajzv v5DZiVPv3WYzLF5H0LWs5F9g5fxI0QVLyfJTAI7bsMfOxworl3NmP3BWV4frdoD4FKvq rhWPnQkUj7eBIKbx3sRlUO1bL27ggJuiAbNC/+DbnzUl7RCi9RNpLEff43kHD8d+/48O GGpYEOC9MuKoPDj7+1/gvqEEWdEzW1dxi9ujBK85KXNvjKro0lkQRgCLFCjgzllceJ+u wp5g== X-Gm-Message-State: AOAM531vn/9g4VacX/nBkX1UzJFIO8cyzf1PbVAQH5uKuj0GFhu8dNAM uI3pTqSRAb2HHe3Oh98Q0ROuBwZKnyVE X-Received: from nandos.syd.corp.google.com ([2401:fa00:9:14:7455:f4f3:5253:80b3]) (user=amistry job=sendgmr) by 2002:a25:7a41:: with SMTP id v62mr28852515ybc.225.1623126766754; Mon, 07 Jun 2021 21:32:46 -0700 (PDT) Date: Tue, 8 Jun 2021 14:32:38 +1000 Message-Id: <20210608143159.1.I230026301243fbcee23d408c75aa468c1fec58f7@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog Subject: [PATCH] drm/amd/display: Fix error code on failure to set brightness From: Anand K Mistry To: amd-gfx@lists.freedesktop.org Cc: Anand K Mistry , Alex Deucher , Aurabindo Pillai , Bas Nieuwenhuizen , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , Daniel Vetter , David Airlie , Eryk Brol , Harry Wentland , Leo Li , Nicholas Kazlauskas , Nikola Cornij , Qingqing Zhuo , Rodrigo Siqueira , Wayne Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The backlight_ops.update_status function is required to return a negative error code on failure. Returning a positive code may be interpreted as a success. This is true for the 'brightness' sysfs file, which passes through a non-zero value as the return value of the write() syscall. This is interpreted in user-space as a successful write of 1 character, which is obviously wrong. It's not clear exactly what error code to use, but EINVAL should be reasonable. Signed-off-by: Anand K Mistry --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 652cc1a0e450..ad322613390d 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3431,7 +3431,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) else rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0); - return rc ? 0 : 1; + return rc ? 0 : -EINVAL; } static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd) -- 2.32.0.rc1.229.g3e70b5a671-goog