linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Qing <wangqing@vivo.com>
To: Hartley Sweeten <hsweeten@visionengravers.com>,
	Alexander Sverdlin <alexander.sverdlin@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Wang Qing <wangqing@vivo.com>
Subject: [PATCH] arm: Add clk_get_rate input parameter null check
Date: Fri,  6 Nov 2020 09:46:15 +0800	[thread overview]
Message-ID: <1604627175-16710-1-git-send-email-wangqing@vivo.com> (raw)

The input parameter of clk_get_rate() is checked with IS_ERR(),
so here we need to check null on clk.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 arch/arm/mach-ep93xx/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 2810eb5..4313b2f
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -321,6 +321,9 @@ static unsigned long get_uart_rate(struct clk *clk)
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	if (clk->get_rate)
 		return clk->get_rate(clk);
 
-- 
2.7.4


             reply	other threads:[~2020-11-06  1:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  1:46 Wang Qing [this message]
2020-11-06  5:57 ` [PATCH] arm: Add clk_get_rate input parameter null check Alexander Sverdlin

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=1604627175-16710-1-git-send-email-wangqing@vivo.com \
    --to=wangqing@vivo.com \
    --cc=alexander.sverdlin@gmail.com \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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).