linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Michael Tretter <m.tretter@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
	Michal Simek <michal.simek@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: soc: xilinx: vcu: issue with 2nd null check on pointer divider
Date: Thu, 8 May 2025 11:21:05 +0100	[thread overview]
Message-ID: <60721f5a-15d2-46a1-aa0c-d6d599244cb2@gmail.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 987 bytes --]

Hi,

There seems to be an issue with the following function with the second 
check on if (!divider). Firstly this is redundant code since divider has
already been null checked, so I suspect it should be instead if (!mux) 
but I'm unsure if this is correct since the call to 
clk_hw_unregister_divider is not made.  Also if mux is null, isn't the 
call to clk_hw_unregister_mux() problematic as a null pointer is being 
passed to it.

static void xvcu_clk_hw_unregister_leaf(struct clk_hw *hw)
{
         struct clk_hw *gate = hw;
         struct clk_hw *divider;
         struct clk_hw *mux;

         if (!gate)
                 return;

         divider = clk_hw_get_parent(gate);
         clk_hw_unregister_gate(gate);
         if (!divider)
                 return;

         mux = clk_hw_get_parent(divider);
         clk_hw_unregister_mux(mux);
         if (!divider)
                 return;

         clk_hw_unregister_divider(divider);
}

Colin

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

             reply	other threads:[~2025-05-08 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 10:21 Colin King (gmail) [this message]
2025-05-08 10:57 ` soc: xilinx: vcu: issue with 2nd null check on pointer divider Michael Tretter
2025-05-08 11:04   ` Colin King (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60721f5a-15d2-46a1-aa0c-d6d599244cb2@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.tretter@pengutronix.de \
    --cc=michal.simek@amd.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).