Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp88201pxy; Tue, 27 Apr 2021 23:34:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYYgXs7HE0pjxA5CMTWnu0HK223UbX5VEK1v2pKLGkthQKnZzDcYE8A0QzzYMaTizIHGER X-Received: by 2002:a62:7646:0:b029:27a:29b6:e10b with SMTP id r67-20020a6276460000b029027a29b6e10bmr7686985pfc.14.1619591674399; Tue, 27 Apr 2021 23:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619591674; cv=none; d=google.com; s=arc-20160816; b=FJ1mpZDnsTj5M148ap5flbEQ8Dwd/1Ni3SBOsxE/8ezKKIlpCDUgrQBjdTwu26ZJFQ +Z3tBn/OWlyef5Y4VuSIfUsn+gCEYZBhnkXE837hX5UVNgra6RNpU43Bg4//8KroHAmZ qYS6EbVMJettlja8VQQHXEQou4FzlvU6DjPKrsfrJgdjdjCJXdmAyP++PfJlv/FsoaRP zdNTadzu9E9lk8p8UNCRdOHkfFzE7KSL5wybokXb/lpwazwlR25xzUzORkeeZpv3lza2 RaD5ys0miz+gFddBrwH5a9qd8FwphMVO7btSfZzRUcr5oCDE89UulM26gEo4AkCQj2gP pJRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9ufzKRdFH1WzHNAXMEe2irJqMg3hNkqCNIBmXFbcgLc=; b=NztuMSRh82DW+Iwjopz4RdlSdVecYDEkWqyV9WVP8ZGT/SEe0Kx5eQrssUuGj019XD St+mVqCVLi+t+mM6QJz9+e0lczbv/IP29ZqjCRtk9SVYI4sj67FBhaxYVqnARQyl7ZL9 c02IY2qFffny7+hbqn64MnNrmZcp329B+GSgkjDZsvU/LO4RgPXWNCuNeJbFAb/L9Ag6 Ea4swzeKg11SYgnkY/7Wqy//XCZYGzNNBww71LNu9yW6NVR5DX6WIRyEw7Yv+rSpHeYE NkDnGYzES1it2IhvdoL97H99lthfP91VS3zXHfriYnNAGN+bpf/YtIsFoYcziHdS8cm2 y9rg== 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 j11si2599033plk.0.2021.04.27.23.34.22; Tue, 27 Apr 2021 23:34:34 -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 S232966AbhD1Gd3 (ORCPT + 99 others); Wed, 28 Apr 2021 02:33:29 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:17048 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbhD1Gd2 (ORCPT ); Wed, 28 Apr 2021 02:33:28 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FVTHx63sGzPtpn; Wed, 28 Apr 2021 14:29:33 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.177.72) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Wed, 28 Apr 2021 14:32:33 +0800 From: Zhen Lei To: Greg Kroah-Hartman , linux-kernel CC: Zhen Lei , Vladimir Oltean Subject: [PATCH 1/1] lib: devres: Add error information printing for __devm_ioremap_resource() Date: Wed, 28 Apr 2021 14:32:03 +0800 Message-ID: <20210428063203.691-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.177.72] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- lib/devres.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/devres.c b/lib/devres.c index 4679dbb1bf5f8a8..bdb06898a977701 100644 --- 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); 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); -- 2.26.0.106.g9fadedd