diff options
author | Mathias Kresin <dev@kresin.me> | 2017-07-28 19:05:33 +0200 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2017-07-29 09:24:47 +0200 |
commit | 1807a0ef835aa358789dbd2328157ddb94f8c07a (patch) | |
tree | a4e9624c7b7a371cb8d4c462d7ab874b8db676d8 | |
parent | 7ab8bf126ef64f0f8e3bca8385742a0d45185e8f (diff) | |
download | upstream-1807a0ef835aa358789dbd2328157ddb94f8c07a.tar.gz upstream-1807a0ef835aa358789dbd2328157ddb94f8c07a.tar.bz2 upstream-1807a0ef835aa358789dbd2328157ddb94f8c07a.zip |
ar7: add NULL clock fix send upstream
Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.
Signed-off-by: Mathias Kresin <dev@kresin.me>
-rw-r--r-- | target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch | 45 | ||||
-rw-r--r-- | target/linux/ar7/patches-4.1/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch | 45 |
2 files changed, 90 insertions, 0 deletions
diff --git a/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch new file mode 100644 index 0000000000..74ac0d1482 --- /dev/null +++ b/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch @@ -0,0 +1,45 @@ +From patchwork Tue Jul 18 10:17:26 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [5/9] MIPS: AR7: allow NULL clock for clk_get_rate +X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com> +X-Patchwork-Id: 16775 +Message-Id: <20170718101730.2541-6-jonas.gorski@gmail.com> +To: unlisted-recipients:; (no To-header on input) +Cc: Ralf Baechle <ralf@linux-mips.org>, + Paul Gortmaker <paul.gortmaker@windriver.com>, + James Hogan <james.hogan@imgtec.com>, + linux-mips@linux-mips.org, linux-kernel@vger.kernel.org +Date: Tue, 18 Jul 2017 12:17:26 +0200 +From: Jonas Gorski <jonas.gorski@gmail.com> +List-Id: linux-mips <linux-mips.eddie.linux-mips.org> + +Make the behaviour of clk_get_rate consistent with common clk's +clk_get_rate by accepting NULL clocks as parameter. Some device +drivers rely on this, and will cause an OOPS otherwise. + +Fixes: 780019ddf02f ("MIPS: AR7: Implement clock API") +Cc: Ralf Baechle <ralf@linux-mips.org> +Cc: Paul Gortmaker <paul.gortmaker@windriver.com> +Cc: James Hogan <james.hogan@imgtec.com> +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Reported-by: Mathias Kresin <dev@kresin.me> +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + arch/mips/ar7/clock.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/mips/ar7/clock.c ++++ b/arch/mips/ar7/clock.c +@@ -430,6 +430,9 @@ EXPORT_SYMBOL(clk_disable); + + unsigned long clk_get_rate(struct clk *clk) + { ++ if (!clk) ++ return 0; ++ + return clk->rate; + } + EXPORT_SYMBOL(clk_get_rate); diff --git a/target/linux/ar7/patches-4.1/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/ar7/patches-4.1/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch new file mode 100644 index 0000000000..74ac0d1482 --- /dev/null +++ b/target/linux/ar7/patches-4.1/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch @@ -0,0 +1,45 @@ +From patchwork Tue Jul 18 10:17:26 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [5/9] MIPS: AR7: allow NULL clock for clk_get_rate +X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com> +X-Patchwork-Id: 16775 +Message-Id: <20170718101730.2541-6-jonas.gorski@gmail.com> +To: unlisted-recipients:; (no To-header on input) +Cc: Ralf Baechle <ralf@linux-mips.org>, + Paul Gortmaker <paul.gortmaker@windriver.com>, + James Hogan <james.hogan@imgtec.com>, + linux-mips@linux-mips.org, linux-kernel@vger.kernel.org +Date: Tue, 18 Jul 2017 12:17:26 +0200 +From: Jonas Gorski <jonas.gorski@gmail.com> +List-Id: linux-mips <linux-mips.eddie.linux-mips.org> + +Make the behaviour of clk_get_rate consistent with common clk's +clk_get_rate by accepting NULL clocks as parameter. Some device +drivers rely on this, and will cause an OOPS otherwise. + +Fixes: 780019ddf02f ("MIPS: AR7: Implement clock API") +Cc: Ralf Baechle <ralf@linux-mips.org> +Cc: Paul Gortmaker <paul.gortmaker@windriver.com> +Cc: James Hogan <james.hogan@imgtec.com> +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Reported-by: Mathias Kresin <dev@kresin.me> +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + arch/mips/ar7/clock.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/mips/ar7/clock.c ++++ b/arch/mips/ar7/clock.c +@@ -430,6 +430,9 @@ EXPORT_SYMBOL(clk_disable); + + unsigned long clk_get_rate(struct clk *clk) + { ++ if (!clk) ++ return 0; ++ + return clk->rate; + } + EXPORT_SYMBOL(clk_get_rate); |