Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3043896pxj; Mon, 7 Jun 2021 00:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4jAX8zBppXBhM1wvh1DWIiq50guaEOpu+oYGMipQG5vcnqdKGHTV3qFit0y8csbF+ulk9 X-Received: by 2002:a05:6402:22f9:: with SMTP id dn25mr18664335edb.241.1623050059981; Mon, 07 Jun 2021 00:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623050059; cv=none; d=google.com; s=arc-20160816; b=CK7vxLWfzCnFTxwaa3RCUAzlq5b75oeKr3PYznAs3GeBDXJSI6BF45e8rz7rNFir1c DOYjfidiPXKeASiTXvceF1u8snLBZjA6raQD8HAG3n4PxFcE6ewn78p/IlZ+PzYNzZdP zR11PFyNfjNUHQJ/KqL1HJiP0402CT851eeTBh2vh39rrzDK+K6K95W4GxjDNpZnJNBj Hqg4qX8ZFlnloT0kOEez1s+r+ZG7AQF6FzIXvyTO7ii4Esde+76OytefGMR19UsRdwe3 N8KbX2kKrQ631z0Fa4RrvBRbnqGWnBRja5azCbpCvC24MBJmtRQJ8/k9/UgQ2vJyWNiq n22A== 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 :cc:to:subject; bh=10GzAVHpd3GxCbGlt0JLNCOSUJOsdGgJMrLcccQyJRM=; b=jGiW8ce/dfOqy1Ja9woMtE+gS2ige5DdRAVunjxOp9csiwt14L0WRrd4hgkgETfM+I FNoFgur9l+eRs5aC64BUuwbs4FpmF5OLqw6WlDWpTDlDthCcOVBytCnQpFCxrsYiB1lP bdnXw9yQOZeAz2WRbU+q2Ss2aBtJBFvocTiIt99/zOuKcJC1OHGGajvorp5FHhXvz2mT 3fCS5rWHf4Z6C5BdTrWh9S+NVBAmG4b30sOdiAxB6pUnCnXPBLdi3vi1oYIz5SZt5V4e WICZqg/dRWx9HMYKnVzj/ixipBIqaW35O74v9z/+lrnkoNXcEqR9mDn4K5qZpq3rQgFO vdLQ== 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 o4si8360100edr.335.2021.06.07.00.13.57; Mon, 07 Jun 2021 00:14:19 -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 S230215AbhFGHMy (ORCPT + 99 others); Mon, 7 Jun 2021 03:12:54 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:4334 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGHMw (ORCPT ); Mon, 7 Jun 2021 03:12:52 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fz4Ck5rsbz1BJmT; Mon, 7 Jun 2021 15:06:10 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 15:10:59 +0800 Received: from [127.0.0.1] (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 15:10:59 +0800 Subject: Re: [PATCH 1/1] lib: devres: Add error information printing for __devm_ioremap_resource() To: Geert Uytterhoeven CC: Greg Kroah-Hartman , linux-kernel , Vladimir Oltean References: <20210428063203.691-1-thunder.leizhen@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: Date: Mon, 7 Jun 2021 15:10:58 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/17 15:04, Geert Uytterhoeven wrote: > Hi Zhen, > > On Wed, Apr 28, 2021 at 8:33 AM Zhen Lei wrote: >> Ensure that all error handling branches print error information. In this >> way, when this function fails, the upper-layer functions can directly >> return an error code without missing debugging information. Otherwise, >> the error message will be printed redundantly or missing. >> >> Fixes: 35bd8c07db2c ("devres: keep both device name and resource name in pretty name") >> Signed-off-by: Zhen Lei > > Thanks for your patch, which is now commit 5c3e241f5246445d ("lib: > devres: Add error information printing for __devm_ioremap_resource()") > in driver-core-next. > >> --- a/lib/devres.c >> +++ b/lib/devres.c >> @@ -157,8 +157,10 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res, >> dev_name(dev), res->name); >> else >> pretty_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); >> - if (!pretty_name) >> + if (!pretty_name) { >> + dev_err(dev, "can't generate pretty name for resource %pR\n", res); > > If the above fails, it is due to a memory allocation failure, and the > memory allocation core will have already printed an error message. > So there is no need to print a second message. > Hence IMHO this commit should be reverted. If the memory allocation fails, only the 'size' is printed, but the start address of the 'res' is not printed. So the printing here is not repeated. The start address is the more critical help information. > >> return IOMEM_ERR_PTR(-ENOMEM); >> + } >> >> if (!devm_request_mem_region(dev, res->start, size, pretty_name)) { >> dev_err(dev, "can't request region for resource %pR\n", res); > > Gr{oetje,eeting}s, > > Geert >