Revert "clk: Return value calculated by ERR_PTR"
PATCH 1/1 Revert "clk: Return value calculated by ERR_PTR"
While this change was intended to fix a mistake in the code, of calling the ERR_PTR macro but not making use of the result, it seems that functionally platforms depend on the loop not existing here. The TI K3 families of platforms for example were broken by this commit.
This reverts commit fe780310cfa8bf5a093894b5cd7fe85c6b02fd91.
--- arch/sandbox/include/asm/clk.h | 1 - drivers/clk/clk-uclass.c | 4 ++-- drivers/clk/clk_sandbox.c | 17 ----------------- test/dm/clk.c | 5 ++--- 4 files changed, 4 insertions(+), 23 deletions(-)
arch/sandbox/include/asm/clk.h +0 -1
@@ -50,7 +50,6 @@ enum sandbox_clk_test_id {struct sandbox_clk_priv {bool probed; -struct clk clk;ulong rate[SANDBOX_CLK_ID_COUNT ];bool enabled[SANDBOX_CLK_ID_COUNT ];bool requested[SANDBOX_CLK_ID_COUNT ];
drivers/clk/clk-uclass.c +2 -2
@@ -199,7 +199,7 @@ static struct clk *clk_set_default_get_by_id(struct clk *clk)if (ret) {debug ("%s(): could not get parent clock pointer, id %lu\n" , __func__, clk->id); -return ERR_PTR (ret); +ERR_PTR (ret); } }
@@ -354,7 +354,7 @@ static int clk_set_default_rates(struct udevice *dev, c =clk_set_default_get_by_id (&clk);if (IS_ERR (c)) -continue ; +return PTR_ERR (c); ret =clk_set_rate (c, rates[index]);
drivers/clk/clk_sandbox.c +0 -17
@@ -8,23 +8,8 @@#include <errno.h> #include <malloc.h> #include <asm/clk.h> -#include <dm/device-internal.h> #include <linux/clk-provider.h> -static int sandbox_clk_of_to_plat (struct udevice *dev) -{ -struct clk *clk; -struct sandbox_clk_priv *priv =dev_get_priv (dev); - - clk = &priv->clk; - -/* FIXME: This is not allowed */ -dev_set_uclass_priv (dev, clk); - - clk->dev = dev; -return 0 ; -} -static ulong sandbox_clk_get_rate (struct clk *clk) {struct sandbox_clk_priv *priv =dev_get_priv (clk->dev);
@@ -117,7 +102,6 @@ static int sandbox_clk_request(struct clk *clk)if (id >=SANDBOX_CLK_ID_COUNT )return -EINVAL ; - priv->clk.id = id; priv->requested[id] = true;return 0 ; }
@@ -148,7 +132,6 @@ U_BOOT_DRIVER(sandbox_clk) = { .name = "sandbox_clk", .id = UCLASS_CLK, .of_match = sandbox_clk_ids, - .of_to_plat = sandbox_clk_of_to_plat, .ops = &sandbox_clk_ops, .probe = sandbox_clk_probe, .priv_auto = sizeof(struct sandbox_clk_priv),
test/dm/clk.c +2 -3
@@ -89,9 +89,8 @@ static int dm_test_clk(struct unit_test_state *uts) SANDBOX_CLK_TEST_ID_SPI));ut_asserteq (0 ,sandbox_clk_test_get_rate (dev_test,SANDBOX_CLK_TEST_ID_I2C )); -if (!CONFIG_IS_ENABLED (CLK_AUTO_ID )) -ut_asserteq (321 ,sandbox_clk_test_get_rate (dev_test, -SANDBOX_CLK_TEST_ID_DEVM1 )); +ut_asserteq (321 ,sandbox_clk_test_get_rate (dev_test, +SANDBOX_CLK_TEST_ID_DEVM1 ));ut_asserteq (0 ,sandbox_clk_test_get_rate (dev_test,SANDBOX_CLK_TEST_ID_DEVM2 ));
Signature · 1 line
2.43.0
Quoted 99 lines · Tom Rini
While this change was intended to fix a mistake in the code, of calling the
ERR_PTRmacro but not making use of the result, it seems that functionally platforms depend on the loop not existing here. The TI K3 families of platforms for example were broken by this commit.This reverts commit
fe780310cfa8bf5a093894b5cd7fe85c6b02fd91.Reported-by Nishanth Menon <[email protected]>Signed-off-by Tom Rini <[email protected]>--- arch/sandbox/include/asm/clk.h | 1 - drivers/clk/clk-uclass.c | 4 ++-- drivers/clk/clk_sandbox.c | 17 ----------------- test/dm/clk.c | 5 ++--- 4 files changed, 4 insertions(+), 23 deletions(-)arch/sandbox/include/asm/clk.h +0
-1@@ -50,7 +50,6 @@ enum sandbox_clk_test_id {struct sandbox_clk_priv {bool probed; -struct clk clk;ulong rate[SANDBOX_CLK_ID_COUNT ];bool enabled[SANDBOX_CLK_ID_COUNT ];bool requested[SANDBOX_CLK_ID_COUNT ];drivers/clk/clk-uclass.c +2
-2@@ -199,7 +199,7 @@ static struct clk *clk_set_default_get_by_id(struct clk *clk)if (ret) {debug ("%s(): could not get parent clock pointer, id %lu\n" , __func__, clk->id); -return ERR_PTR (ret); +ERR_PTR (ret); } }@@ -354,7 +354,7 @@ static int clk_set_default_rates(struct udevice *dev, c =clk_set_default_get_by_id (&clk);if (IS_ERR (c)) -continue ; +return PTR_ERR (c); ret =clk_set_rate (c, rates[index]);drivers/clk/clk_sandbox.c +0
-17@@ -8,23 +8,8 @@#include <errno.h> #include <malloc.h> #include <asm/clk.h> -#include <dm/device-internal.h> #include <linux/clk-provider.h> -static int sandbox_clk_of_to_plat (struct udevice *dev) -{ -struct clk *clk; -struct sandbox_clk_priv *priv =dev_get_priv (dev); - - clk = &priv->clk; - -/* FIXME: This is not allowed */ -dev_set_uclass_priv (dev, clk); - - clk->dev = dev; -return 0 ; -} -static ulong sandbox_clk_get_rate (struct clk *clk) {struct sandbox_clk_priv *priv =dev_get_priv (clk->dev);@@ -117,7 +102,6 @@ static int sandbox_clk_request(struct clk *clk)if (id >=SANDBOX_CLK_ID_COUNT )return -EINVAL ; - priv->clk.id = id; priv->requested[id] = true;return 0 ; }@@ -148,7 +132,6 @@ U_BOOT_DRIVER(sandbox_clk) = { .name = "sandbox_clk", .id = UCLASS_CLK, .of_match = sandbox_clk_ids, - .of_to_plat = sandbox_clk_of_to_plat, .ops = &sandbox_clk_ops, .probe = sandbox_clk_probe, .priv_auto = sizeof(struct sandbox_clk_priv),test/dm/clk.c +0
-0
test/dm/clk.c static int dm_test_clk(struct unit_test_state *uts) · line 95
Quoted 10 lines
test/dm/clk.c +2
-3@@ -89,9 +89,8 @@ static int dm_test_clk(struct unit_test_state *uts) SANDBOX_CLK_TEST_ID_SPI));ut_asserteq (0 ,sandbox_clk_test_get_rate (dev_test,SANDBOX_CLK_TEST_ID_I2C )); -if (!CONFIG_IS_ENABLED (CLK_AUTO_ID )) -ut_asserteq (321 ,sandbox_clk_test_get_rate (dev_test, -SANDBOX_CLK_TEST_ID_DEVM1 )); +ut_asserteq (321 ,sandbox_clk_test_get_rate (dev_test, +SANDBOX_CLK_TEST_ID_DEVM1 ));ut_asserteq (0 ,sandbox_clk_test_get_rate (dev_test,SANDBOX_CLK_TEST_ID_DEVM2 ));
Nishanth Menon
Reviewed-byQuoted 10 lines · Andrew Goodbody
Quoted 9 lines · Tom Rini
While this change was intended to fix a mistake in the code, of calling the
ERR_PTRmacro but not making use of the result, it seems that functionally platforms depend on the loop not existing here. The TI K3 families of platforms for example were broken by this commit.This reverts commit
fe780310cfa8bf5a093894b5cd7fe85c6b02fd91.Reported-by Nishanth Menon <[email protected]>Signed-off-by Tom Rini <[email protected]>
[...]
Quoted 3 lines
Reviewed-by Andrew Goodbody <[email protected]>
Signature · 4 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D https://ti.com/opensource
Quoted 8 lines · Tom Rini
While this change was intended to fix a mistake in the code, of calling the
ERR_PTRmacro but not making use of the result, it seems that functionally platforms depend on the loop not existing here. The TI K3 families of platforms for example were broken by this commit.This reverts commit
fe780310cfa8bf5a093894b5cd7fe85c6b02fd91.[...]
Applied to u-boot/next, thanks!
[1/1] Revert "clk: Return value calculated by ERR_PTR"
commit: aff0f4d30ec6d7968578fc05fc6df6b5700d9913
Signature · 1 line
Tom