From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A281C433FE for ; Wed, 27 Oct 2021 07:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E703360F9B for ; Wed, 27 Oct 2021 07:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240475AbhJ0HYE (ORCPT ); Wed, 27 Oct 2021 03:24:04 -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-Google-Smtp-Source: ABdhPJw6IL68kkowHN7Yu0essb69SRPCBVccgeJ+WNljMxXXHKCcC5zM0h3UsdoOsuhcE8Y+eldzBw== 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: devicetree@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