Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2605917pxj; Mon, 17 May 2021 05:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6pr4AByoS29s3Gx9nd5fseyZ6xiQXyo/mMIP/k4xR2qhASah3KdcGRJ8XGxLLjZyWVyFl X-Received: by 2002:a05:6402:5158:: with SMTP id n24mr70968854edd.74.1621255493398; Mon, 17 May 2021 05:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621255493; cv=none; d=google.com; s=arc-20160816; b=kzT7xGvIdBOjXX1S0+DFkTsvO5uqbZAP7pH8TcFy0cjl0eVgAjEnMYth4Si+5q88rd 1zlIQwfMorsUyksAgfVE6hh/NFa3FoxNx01u1YP/FL5DhO3rjGnigwl5RBuzIaxaIsQK GIfkna/S31r3bsS6lyazRYQfiVB0R2ojplgAA55TiRNelSz4dPVBTl4JL0ulDot8va8L GBBP2aViWsMqxf6cjRJJYV3WtyOHzGwjVHKz8+JBGDTbEA9FaJRXCUydoJ94zjDsiYso m6Dcy1B26l8/4yTu9LJuFCCbDlaL8DjAHx202bBZKcNCqeAiPo9f64uMx6euc8M7dFFk GmMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=5C/REeXdcVCAYpjd6rjo76Xzl3K9167BGJ9+kDZAb2U=; b=FXzJOe4b8rnIBuaBRTH/YkW5B4jGZ/0J7p0p+FhuHCzHj95XEWu3xbsQCptVuZS230 bigsyCyzyJEvFnjEfGi7y7LqyGcKYBXUPFCY9Pzizzmxb+QKs7pI1rImprZflw82jmUb ACgG4c2npuDDEOJXgy5yI7GHp21al5meCTxq0m60RS4L6z/+nYtuQCx4Urrq9YJU3TsJ 3vPuke8eHwZzwANzEwOCMzHQL4FEU1E7IpjFW1BNT7i58ZubbKVf4lBZ4aQwunZDX+zt aOd8d8cPlO1N6voBJADkmUJ00p6KJ6Ir6TsGCKndiIFU8HxxmCcmw55En0vgGrSqFccv YEWA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay13si9769837edb.577.2021.05.17.05.44.30; Mon, 17 May 2021 05:44:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbhEQHGB (ORCPT + 99 others); Mon, 17 May 2021 03:06:01 -0400 Received: from mail-ua1-f50.google.com ([209.85.222.50]:38433 "EHLO mail-ua1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235197AbhEQHFo (ORCPT ); Mon, 17 May 2021 03:05:44 -0400 Received: by mail-ua1-f50.google.com with SMTP id k45so1780428uag.5 for ; Mon, 17 May 2021 00:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5C/REeXdcVCAYpjd6rjo76Xzl3K9167BGJ9+kDZAb2U=; b=MBhaO9uxEoQAjBjwKzypRIQ6ctDenaCx7kdUMWjzyxshYdiRKe8YKjHYQvtht7l3Em wJi2EPCui+YVx8voCG49a/p+uuLbe9HjKXJhK6mbXLVO5jsu3gf8wWIcIeoymKCcnIE/ aU+vFhq1H6E+WIxzlJQ6cVvBF3t8iqQC/co+R3V2NQItCTFnQIrak4OtXQe6Lko3fKVY PA/FZR9NfRVvp5tXS5YDraA3n0i889VQceH4LCvxDY7FTpqsNvqyJfarBqQ46XBYAHzS yPBI8Yqq42GvkhMyj9vxVvcUTb9bfsttSMrmTPWGgs9uZMMx0gTW36e6pJESECt8QLoN wEag== X-Gm-Message-State: AOAM531YsNlycATOqfHSTzMCt4YlzPDoMaAeToKy+DIhpma/nCEaA874 U/vCvCtrXn9bg0jnhg8jMxRhKFI3qDMJvoEVJrU= X-Received: by 2002:ab0:2a8b:: with SMTP id h11mr28365814uar.4.1621235067214; Mon, 17 May 2021 00:04:27 -0700 (PDT) MIME-Version: 1.0 References: <20210428063203.691-1-thunder.leizhen@huawei.com> In-Reply-To: <20210428063203.691-1-thunder.leizhen@huawei.com> From: Geert Uytterhoeven Date: Mon, 17 May 2021 09:04:15 +0200 Message-ID: Subject: Re: [PATCH 1/1] lib: devres: Add error information printing for __devm_ioremap_resource() To: Zhen Lei Cc: Greg Kroah-Hartman , linux-kernel , Vladimir Oltean Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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 -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds