Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1709108pxb; Fri, 22 Oct 2021 06:15:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2GVySxSRzLpU7HE8jvR5Ox8l7DBCljzQoGyALMJZc4JyMFL9SHNSH/TSTtvlxVQSz4bbq X-Received: by 2002:a17:902:e881:b0:140:1d60:130f with SMTP id w1-20020a170902e88100b001401d60130fmr1866882plg.80.1634908554923; Fri, 22 Oct 2021 06:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634908554; cv=none; d=google.com; s=arc-20160816; b=VGRgE3naK5TlI2dwzSw/sccctOSPJlSbUsa1mdzJo6gsH6DvOK6c58HEj7B18AuctE Sjfb+0xMEQYBu+8szhKPTiIwN5khXpAM/THPlnJ5LiklItYER7WGRLyiuSBkUAea9H8b zNJDFhOEy6zENKoXluI7UEm5xU4jbLGc9pG/XY3ocvShqOj6NLBuwTzPQtulg92oW5X6 LNXS+JpPG9l4weCpXS7tgUDmWPCMe/yQgVfGz5v5LYx8FjHOopNeSNK9DVzZOcOSXxf/ 70BfEV/l+dvhmFao/3AxVC+IIW8nadRcklLrQQA1DYNTHkjHkLRzyl7EoFezVamhtPbj lFTQ== 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=3OEFGu3enLvj4SiHrgtW22LytEptjzZQ2XovqUzzJxs=; b=Sfp6mtHkiZfJAPTYJearLRbTd0RY1QKrFuyUMU9IoDrIIjUW7qdTW/NkWsFUV+zIFe bMAvf6E93T3M6rIZme2hvaBZmsgUFXAIfKtSJlsSujyOgovBvD4gdDiMwwc7oMORko5B LzIUEyMjdrRz5SRIT/jWT5qgpm8k/Z40duNfJzlwzdlmbH7B9bFxyUL81Pf5Aigtkw54 1f/oofJP16IZn0vbjXvojRWROWDU9P9SMYT4QWdEemqhepva639wMihl/DAhITBD+/+X uYPC9wrsrDJeSvETIN0Pvb5WDCE2oBJDMboyTZ0hLiup7lCHKNckKt7aFI3Mg5AErQWR orJA== 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 w190si10996099pgd.424.2021.10.22.06.15.41; Fri, 22 Oct 2021 06:15:54 -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 S232876AbhJVNQP (ORCPT + 99 others); Fri, 22 Oct 2021 09:16:15 -0400 Received: from mail-pl1-f178.google.com ([209.85.214.178]:47074 "EHLO mail-pl1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232827AbhJVNQN (ORCPT ); Fri, 22 Oct 2021 09:16:13 -0400 Received: by mail-pl1-f178.google.com with SMTP id i1so2638895plr.13; Fri, 22 Oct 2021 06:13:56 -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=3OEFGu3enLvj4SiHrgtW22LytEptjzZQ2XovqUzzJxs=; b=nQlnjLb0xaEQ9s8nFvdNgPY0GIxKJ+7Z/bcDdya4eKXAVWfCFGvLZZthyIrbQLZ1Kd /CFPZZJVnIwwKWPJwnh71t5q0m06yH20QsOIYhdnOvwzI4xF94/IeI1Kd6x887c0dIjV dP3L/ugz+o8vQ//qfOXfR4RmBwuoIyqJ/oSuaUuFLPphP8OMUGfGrxkhmGBQbXvtpELM Db1e6ktKBz6GlGjfO+dUKVkXoLpYppgfwdeU3J38ql9JWS9dbdv6QyRcC6PfEOhx566w 3Ne734B4tDWmfyCvdkpU/7DNux9zMhpRspT1KR7NAmp9FVBeFXQGvuFifx/SBfMNBT46 ZA/Q== X-Gm-Message-State: AOAM5301zVQQROmUIDXdyP4pt2a3x8tyL80ZgytDxmGufo51uyhHKIy9 i0dg1BkpL9ZpA1MBVQb3/s9oJRwynHd7L1bNijg= X-Received: by 2002:a17:90b:98:: with SMTP id bb24mr4342124pjb.194.1634908435520; Fri, 22 Oct 2021 06:13:55 -0700 (PDT) MIME-Version: 1.0 References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-7-kernel@esmil.dk> In-Reply-To: From: Emil Renner Berthing Date: Fri, 22 Oct 2021 15:13:44 +0200 Message-ID: Subject: Re: [PATCH v2 06/16] clk: starfive: Add JH7100 clock generator driver To: Andy Shevchenko Cc: linux-riscv , devicetree , linux-clk , "open list:GPIO SUBSYSTEM" , "open list:SERIAL DRIVERS" , Geert Uytterhoeven , Palmer Dabbelt , Paul Walmsley , Rob Herring , Michael Turquette , Stephen Boyd , Thomas Gleixner , Marc Zyngier , Philipp Zabel , Linus Walleij , Greg Kroah-Hartman , Daniel Lezcano , Andy Shevchenko , Jiri Slaby , Maximilian Luz , Sagar Kadam , Drew Fustini , Michael Zhu , Fu Wei , Anup Patel , Atish Patra , Matteo Croce , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Oct 2021 at 14:34, Andy Shevchenko wrote: > On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing wrote: > > ... > > > +static struct clk_hw *clk_starfive_jh7100_get(struct of_phandle_args *clkspec, void *data) > > +{ > > + struct clk_starfive_jh7100_priv *priv = data; > > + unsigned int idx = clkspec->args[0]; > > + > > + if (idx >= JH7100_CLK_END) { > > + dev_err(priv->dev, "invalid clock index %u\n", idx); > > + return ERR_PTR(-EINVAL); > > After this > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=7065f92255bb2468dbb9aa0537ff186ef64d5a02 > It's okay to use > > > + } > > if (idx >= JH7100_CLK_END) > return dev_err_probe(priv->dev, -EINVAL, "invalid clock > index %u\n", idx); > > Ditto for other similar cases. Hmm.. this function doesn't return int, but struct clk_hw *, hence the ERR_PTR. Also I don't see any other similar cases in this driver. > > + if (idx >= JH7100_CLK_PLL0_OUT) > > + return priv->pll[idx - JH7100_CLK_PLL0_OUT]; > > + > > + return &priv->reg[idx].hw; > > +} > > ... > > > + while (idx) > > + clk_hw_unregister(&priv->reg[--idx].hw); > > I still consider that usual pattern, i.e. > > while (idx--) > clk_hw_unregister(&priv->reg[idx].hw); > > but since you are pushing hard for your variant I'll leave it to the > maintainers and author. > > -- > With Best Regards, > Andy Shevchenko