Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp912211pxj; Sat, 8 May 2021 02:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMIbcrRTPLu7XY50wIqKlKZoZw9Z6eYJK4M47so9u90OZ8lCXooEeZSQN25mxXhXol/3oS X-Received: by 2002:aa7:d90d:: with SMTP id a13mr16533506edr.76.1620465581710; Sat, 08 May 2021 02:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620465581; cv=none; d=google.com; s=arc-20160816; b=BRoOqQkryneofmTsL88e3LJ1AaNEmIYID0MzDT8aQ3dRbs8uUdKYkGmUU1Phoots3V k2Rf9IEvtRh9h+1KNq7IPqXMoRYtdP0k99aBLUYeY509LHRblGJDfBUlDhDn8EJJ0axw 3mITFIggd1rN0yoplwdUrtNJNkg0r9DPFaptq5RGROb/qLBw57oDz6d6P1Ud8gjCXFVr Mx2CyKGfpgQEt4lXX8LAJ+IYdtfK3UA/cZJjI3OfzvFC7U0adVMhq1Lr6EraDKZ+fydb VmHntUNr6RY8LM3naG6tUMbyncmCyVHxcGdKs04q9vXF3dnPNTLiO0S9ZK4hS8PiYClz L5ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=3qclf3J5jejEcFNAW4lVSnBBLbYFoXJi4hNgnncymDk=; b=x9DprKUc1gV3/L2SwGNW9juCQHxft+VHLbRakujJVIXTkbc392AyEMLlFhincgQmK/ kxbRtH37o3riH8qRrZIiohWT6LQ7DFsdCEShjLyAFudox6H8n4lmWF25PNqQp5cwYCyZ ZBL5T77Qwwz0dF8PWOE634Nv89TMgmuVGL71tJlhi4a7cxL5ZETTFFVsDJcaQY88x05/ YCHWmpAOsht7vEKFaWFpN5eDW1sk7c1SHpM/gnyuv7FGxV1QcRYxos9N7C/y+C9FYjvU YPDdxApjczxcKR5+QnsiU7DtU23PYp01maV/gnvKqp5ulCBh1bxWv5ckMxyTyoIooiyj yr+g== ARC-Authentication-Results: i=1; mx.google.com; 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si8231870edc.150.2021.05.08.02.19.17; Sat, 08 May 2021 02:19:41 -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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbhEHJTZ (ORCPT + 99 others); Sat, 8 May 2021 05:19:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:18014 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbhEHJTZ (ORCPT ); Sat, 8 May 2021 05:19:25 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FchVB5wbPzQkJl; Sat, 8 May 2021 17:14:58 +0800 (CST) Received: from [127.0.0.1] (10.174.177.72) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Sat, 8 May 2021 17:18:14 +0800 Subject: Re: [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init() To: Dan Carpenter , Ben Skeggs , David Airlie , Daniel Vetter , dri-devel , nouveau , linux-kernel References: <20210508034810.2374-1-thunder.leizhen@huawei.com> <20210508073400.nnmwwyoxqqiwv36w@pmoreau.org> From: "Leizhen (ThunderTown)" Message-ID: <0b94bd89-c8a0-f1e8-057f-2f639464fadd@huawei.com> Date: Sat, 8 May 2021 17:18:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20210508073400.nnmwwyoxqqiwv36w@pmoreau.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.72] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/8 15:34, Pierre Moreau wrote: > Hello Zhen, > > There was a similar patch sent in last month, though which does not seem to > have been merged yet; see > https://lists.freedesktop.org/archives/nouveau/2021-April/038451.html. > > Whether `ret` should be `-ENOSPC` or `-ENOMEM` is hard to say as > `nouveau_get_backlight_name()` could fail due to either. > > I will propose an alternative fix which modifies `nouveau_get_backlight_name()` > to return an int so the actual error code can be propagated back instead of > guessed, as well as fix an ida ID leak which I just spotted. It's a good idea. > > Best, > Pierre > > On 2021-05-08 — 11:48, Zhen Lei wrote: >> Fix to return a negative error code from the error handling case instead >> of 0, as done elsewhere in this function. >> >> Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces") >> Reported-by: Hulk Robot >> Signed-off-by: Zhen Lei >> --- >> drivers/gpu/drm/nouveau/nouveau_backlight.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c >> index 72f35a2babcb..097ca344a086 100644 >> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c >> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c >> @@ -273,6 +273,7 @@ nouveau_backlight_init(struct drm_connector *connector) >> return -ENOMEM; >> >> if (!nouveau_get_backlight_name(backlight_name, bl)) { >> + ret = -ENOSPC; >> NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n"); >> goto fail_alloc; >> } >> -- >> 2.25.1 >> >> > > . >