Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp823329pxb; Wed, 27 Oct 2021 13:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhXiPCHGEu48Rg8f3r1zRXm1czbEykiH3e+y0GBRa8FuaTPwgw1Kd71uUPCedDkjiCXolW X-Received: by 2002:a63:2066:: with SMTP id r38mr3215341pgm.389.1635365289055; Wed, 27 Oct 2021 13:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635365289; cv=none; d=google.com; s=arc-20160816; b=DQOp6LJxtYS7xzNCCZZN/S4v2I2sClM3XYvLvr0/KkASTJYSnQFodKN6K9by7hQeGf TvRfNiWYbRI6ftOOJ6PpaPHNQf4ZXamWff+B3rRqQBT2AKs1bVwl7jwAoy5xPGJkNSpF a4NmEON2dyctzctckeE89xEESVeRZe9Zsvvrvd248XCIXxYey7cmo1B9qFw+d6jAq4dn 7QnZQawy5kupukzJ+7MWkZwQjGMFwLnjhJtn0lwatNXA+upYMpKuXaLs1EbDhUisrvtk IRtHpgUQLS2Qx5eRz06aI9AQr08LRkQ6o1MEgLH60MccElxs1wDDUXT6KTvG4ini8glr 1U0A== 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=XEkFa+Ku/oXy3Y71Wa/RXXm6+I0giMexz18AaglX7hA=; b=E2DMJL9e2veMcc/PPxt6EVKo9pnTJaRFpS9lrdSrVk49eNLNox8VmJ4fIvZ0/JPhBR f4vfFIAU+yrUFlcDmpORu154secUyJLdsiyAuOm7wbCTqJvL/f4stvSaqqpV3MMLHI2b PwoNg+JsC750gmyIkPgbmhniMEheaHsqhtGLMKOP+/ZmeZIwDAHnj3iBF9n7cUqjGTi0 R3C6U7dRTGXkAU7heJXSMVaun5lZewSRBYZ8AnpPAMOMQjvZ+J0T0f/3PvGV2GWw65by Phb/2XyA5/YtuAH0svr4GQ18fCsnR8a1cO2LMMjh7OMw4K0bieJr2a5S5kzq5WHeDBID J5zg== 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 np15si7812230pjb.54.2021.10.27.13.07.55; Wed, 27 Oct 2021 13:08:09 -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 S240461AbhJ0HYF (ORCPT + 99 others); Wed, 27 Oct 2021 03:24:05 -0400 Received: from mail-ua1-f47.google.com ([209.85.222.47]:36846 "EHLO mail-ua1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240471AbhJ0HYD (ORCPT ); Wed, 27 Oct 2021 03:24:03 -0400 Received: by mail-ua1-f47.google.com with SMTP id e10so3175095uab.3; Wed, 27 Oct 2021 00:21:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XEkFa+Ku/oXy3Y71Wa/RXXm6+I0giMexz18AaglX7hA=; b=250+CIzlUU/59Sd+f3UO1OhOlITbP+7hy0Qhi8HsOyTbfPDvrzRublON81n1DVl5O5 l0t6VErruzxoQnNpoyUx9m3UByOgIyhGfIpqxpPuvhFIOb3y8posdsosa7DC3f1loxVn 9SZ38pDMvGJ0ZFEqrFN7jyPwHy/hlnWdMg6OeAcVe5LthZOLCOFp/lo16s8mmyhQwqVj 7u58eAPxQsJXonwjo5fnEx+dR9KwrZGPerDI0C/oy6vvF7VnCKJFVmKC3zX1wzRdV+pD c5qIee0Vc54TdwehRMKOnY0Q69nyJJKk+BWN1yqHOLaICAOA9HQYLGvZm0hj+UQyPn/m af4w== X-Gm-Message-State: AOAM53347eBIECn7xtVyEgz1kKJbQyzt3VTPZi8fEvY4fEQMLYEIo5sZ XnHd6Q6qKIozzlE3hCv7X6ACTtD7Cxum7w== X-Received: by 2002:a05:6102:cd2:: with SMTP id g18mr28671857vst.25.1635319297590; Wed, 27 Oct 2021 00:21:37 -0700 (PDT) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com. [209.85.222.44]) by smtp.gmail.com with ESMTPSA id m34sm10655938uad.5.2021.10.27.00.21.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 00:21:36 -0700 (PDT) Received: by mail-ua1-f44.google.com with SMTP id ba32so3138073uab.6; Wed, 27 Oct 2021 00:21:36 -0700 (PDT) X-Received: by 2002:a05:6102:3a0e:: with SMTP id b14mr747714vsu.41.1635319295910; Wed, 27 Oct 2021 00:21:35 -0700 (PDT) MIME-Version: 1.0 References: <20211025205631.21151-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20211025205631.21151-6-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 27 Oct 2021 09:21:24 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/7] memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails To: Lad Prabhakar Cc: Krzysztof Kozlowski , Rob Herring , Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Mark Brown , Philipp Zabel , Wolfram Sang , Sergei Shtylyov , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , MTD Maling List , linux-spi , Linux-Renesas , Prabhakar , Biju Das , Chris Brandt Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 27, 2021 at 9:17 AM Geert Uytterhoeven wrote: > On Mon, Oct 25, 2021 at 10:57 PM Lad Prabhakar > wrote: > > Make sure we return error in case devm_ioremap_resource() fails for dirmap > > resource. > > > > Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver") > > Signed-off-by: Lad Prabhakar > > Reviewed-by: Biju Das > > Reviewed-by: Wolfram Sang > > Thanks for your patch! > > > --- a/drivers/memory/renesas-rpc-if.c > > +++ b/drivers/memory/renesas-rpc-if.c > > @@ -243,7 +243,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev) > > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); > > rpc->dirmap = devm_ioremap_resource(&pdev->dev, res); > > if (IS_ERR(rpc->dirmap)) > > - rpc->dirmap = NULL; > > + return PTR_ERR(rpc->dirmap); > > IIRC, it was intentional to make the dirmap optional (because the > device can be used without and/or because some variants on other SoCs > lack it?). Unfortunately this is not reflected in the DT bindings > (yet?). All code using the dirmap does check if rpc->dirmap is > valid first. > > > rpc->size = resource_size(res); Of course this will crash if the dirmap is not present, so for now it's better to just bail out. Reviewed-by: Geert Uytterhoeven > > > > rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); 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