Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3081833pxj; Mon, 7 Jun 2021 01:35:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJOKZhX9V2JF29C86KK/L3gO0ZshuONOQVVHRdEH6Xl9kXp4IUNwF0UhfXfOG24pIOSAmt X-Received: by 2002:a17:906:3057:: with SMTP id d23mr16886423ejd.131.1623054939084; Mon, 07 Jun 2021 01:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623054939; cv=none; d=google.com; s=arc-20160816; b=vCwjeKz/zdXkvfjR7/rlSUtMOk44exFIQEtYXcnbLJ77BbaXHB4Jk/5AqVu0dNMbJI M8EhBZHNd2bt6wKilWRo3zPJZpQps8sP1yrldHWHdij6KW5Z4Sjd2f2+hq2nkGAp15KQ VMmoRi+uJnit+JySfn1MbumZ2hAmKcWbdYKbUXYhk2inEmekNEPc6e9PdOKUaM86mPYy ftvpUIMLd64mc7TJO9Ju2p0C0TA0fkOjb1LnHKNiaRwNce+IVVhlBUwCoqnzZXEzIr7n e8VhH03YsnecwFYfC0ivaHsmDdu3bkuCCS7atC5obbyo4bqXAU/SgWsNzG9m6UUQBzU0 M4+w== 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=xBrONAaeVtWMM4Er9OJSV1kBLjhNP2cXNkNjK3QQPNc=; b=BpEnU12IDD1eIUoLVc4zkjAB0n/2WL4URC+8aVLmcrD4IMOZgBFgSaBbCa4fdhmv1X sV3OOzH8OtYn8BFtbzToUYx/DyOMLqlx7cujPlRawgejOqM7JQJc5j3MlKswJyNoF9sp ZryVsXJLFcB3IuscWT3HK/A1q2iszASlz6+UkCIonyqDPKiQpC8IaoS26HnT12b03vrx 9oX94Cb729B1LbwdiT+H32Xrl0pVreHCT56XtozAQ7cU5bmEP8RHZ6INHQg+VgBLDpZz FZCaC5bNBP4Pf1iEvp4PCChrIci8zn45iGvXt8Pqw6/6b41/yfr8R8YrAyR9SDlH5uEc qv7g== 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 j23si13803950eje.719.2021.06.07.01.35.15; Mon, 07 Jun 2021 01:35:39 -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 S230242AbhFGIe5 (ORCPT + 99 others); Mon, 7 Jun 2021 04:34:57 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3080 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhFGIe5 (ORCPT ); Mon, 7 Jun 2021 04:34:57 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fz62Q6jcgzWstj; Mon, 7 Jun 2021 16:28:14 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) 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 16:33:04 +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 16:33:03 +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: <2c0a1977-2f87-7fd5-13db-e9524f0fed80@huawei.com> Date: Mon, 7 Jun 2021 16:33:03 +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: dggems706-chm.china.huawei.com (10.3.19.183) 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/6/7 16:15, Geert Uytterhoeven wrote: > Hi Leizhen, > > On Mon, Jun 7, 2021 at 9:11 AM Leizhen (ThunderTown) > wrote: >> On 2021/5/17 15:04, Geert Uytterhoeven wrote: >>> 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. > > Does that actually matter? > What can the user or developer do to fix this problem, with the > additional knowledge of the resource's start address? Oh, you're right. > >>>> 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 >