memory: Few code cleanups
Subsystems (2)
cover memory: Few code cleanups
Few cleanups for Renesas and Tegra.
Best regards,
Krzysztof
---
Krzysztof Kozlowski (4):
memory: renesas-rpc-if: Simplify printing PTR_ERR with dev_err_probe
memory: tegra-mc: Drop tegra_mc_setup_latency_allowance() return value
memory: tegra-mc: Simplify printing PTR_ERR with dev_err_probe
memory: tegra-mc: Use %pe format
drivers/memory/renesas-rpc-if.c | 8 +++----- drivers/memory/tegra/mc.c | 26 ++++++++------------------ 2 files changed, 11 insertions(+), 23 deletions(-)
---
base-commit: 7d6661873f6b54c75195780a40d66bad3d482d8f
change-id: 20260226-memory-simplify-c49c46d55c02
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
PATCH 1/4 memory: renesas-rpc-if: Simplify printing PTR_ERR with dev_err_probe
Use dev_err_probe() to simplify the code and fix Coccinelle warning:
renesas-rpc-if.c:1010:3-10: WARNING: Consider using %pe to print PTR_ERR()
--- drivers/memory/renesas-rpc-if.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/memory/renesas-rpc-if.c +3 -5
@@ -1005,11 +1005,9 @@ static int rpcif_probe(struct platform_device *pdev)return PTR_ERR (rpc->base); rpc->info =of_device_get_match_data (dev); rpc->regmap =devm_regmap_init (dev,NULL , rpc, rpc->info->regmap_config); -if (IS_ERR (rpc->regmap)) { -dev_err (dev,"failed to init regmap for rpcif, error %ld\n" , -PTR_ERR (rpc->regmap)); -return PTR_ERR (rpc->regmap); - } +if (IS_ERR (rpc->regmap)) +return dev_err_probe (dev,PTR_ERR (rpc->regmap), +"failed to init regmap for rpcif\n" ); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dirmap" ); rpc->dirmap =devm_ioremap_resource (dev, res);
Signature · 1 line
2.51.0
PATCH 2/4 memory: tegra-mc: Drop tegra_mc_setup_latency_allowance() return value
In reply to Krzysztof Kozlowskitegra_mc_setup_latency_allowance() only succeeds, thus its return value can be dropped making code a bit simpler.
--- drivers/memory/tegra/mc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/memory/tegra/mc.c +2 -8
@@ -386,7 +386,7 @@ EXPORT_SYMBOL_GPL(tegra_mc_get_emem_device_count);defined (CONFIG_ARCH_TEGRA_124_SOC ) || \defined (CONFIG_ARCH_TEGRA_132_SOC ) || \ defined(CONFIG_ARCH_TEGRA_210_SOC) -static int tegra_mc_setup_latency_allowance (struct tegra_mc *mc) +static void tegra_mc_setup_latency_allowance (struct tegra_mc *mc) {unsigned long long tick;unsigned int i;
@@ -414,8 +414,6 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)/* latch new values */ mc_writel (mc,MC_TIMING_UPDATE ,MC_TIMING_CONTROL ); - -return 0 ; } static int load_one_timing(struct tegra_mc *mc,
@@ -517,11 +515,7 @@ int tegra30_mc_probe(struct tegra_mc *mc)/* ensure that debug features are disabled */ mc_writel (mc,0x00000000 ,MC_TIMING_CONTROL_DBG ); - err =tegra_mc_setup_latency_allowance (mc); -if (err <0 ) { -dev_err (mc->dev,"failed to setup latency allowance: %d\n" , err); -return err; - } +tegra_mc_setup_latency_allowance (mc); err =tegra_mc_setup_timings (mc);if (err <0 ) {
Signature · 1 line
2.51.0
Re: [PATCH 2/4] memory: tegra-mc: Drop tegra_mc_setup_latency_allowance() return value
Quoted 7 lines · Krzysztof Kozlowski
tegra_mc_setup_latency_allowance()only succeeds, thus its return value can be dropped making code a bit simpler.Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/memory/tegra/mc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
PATCH 3/4 memory: tegra-mc: Simplify printing PTR_ERR with dev_err_probe
In reply to Krzysztof KozlowskiUse dev_err_probe() to simplify the code and fix Coccinelle warning:
tegra/mc.c:513:52-59: WARNING: Consider using %pe to print PTR_ERR()
--- drivers/memory/tegra/mc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/memory/tegra/mc.c +5 -8
@@ -507,10 +507,9 @@ int tegra30_mc_probe(struct tegra_mc *mc)int err; mc->clk =devm_clk_get_optional (mc->dev,"mc" ); -if (IS_ERR (mc->clk)) { -dev_err (mc->dev,"failed to get MC clock: %ld\n" ,PTR_ERR (mc->clk)); -return PTR_ERR (mc->clk); - } +if (IS_ERR (mc->clk)) +return dev_err_probe (mc->dev,PTR_ERR (mc->clk), +"failed to get MC clock\n" );/* ensure that debug features are disabled */ mc_writel (mc,0x00000000 ,MC_TIMING_CONTROL_DBG );
@@ -518,10 +517,8 @@ int tegra30_mc_probe(struct tegra_mc *mc)tegra_mc_setup_latency_allowance (mc); err =tegra_mc_setup_timings (mc); -if (err <0 ) { -dev_err (mc->dev,"failed to setup timings: %d\n" , err); -return err; - } +if (err <0 ) +return dev_err_probe (mc->dev, err,"failed to setup timings\n" );return 0 ; }
Signature · 1 line
2.51.0
Re: [PATCH 3/4] memory: tegra-mc: Simplify printing PTR_ERR with dev_err_probe
Quoted 8 lines · Krzysztof Kozlowski
Use
dev_err_probe()to simplify the code and fix Coccinelle warning:tegra/mc.c:513:52-59: WARNING: Consider using %pe to print
PTR_ERR()Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/memory/tegra/mc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
PATCH 4/4 memory: tegra-mc: Use %pe format
In reply to Krzysztof KozlowskiMake code printing pointer error value a bit simpler and fix coccinelle suggestion:
tegra/mc.c:975:4-11: WARNING: Consider using %pe to print PTR_ERR()
--- drivers/memory/tegra/mc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/memory/tegra/mc.c +1 -2
@@ -962,8 +962,7 @@ static int tegra_mc_probe(struct platform_device *pdev)if (IS_ENABLED (CONFIG_TEGRA_IOMMU_SMMU ) && mc->soc->smmu) { mc->smmu =tegra_smmu_probe (&pdev->dev, mc->soc->smmu, mc);if (IS_ERR (mc->smmu)) { -dev_err (&pdev->dev,"failed to probe SMMU: %ld\n" , -PTR_ERR (mc->smmu)); +dev_err (&pdev->dev,"failed to probe SMMU: %pe\n" , mc->smmu); mc->smmu =NULL ; } }
Signature · 1 line
2.51.0
Re: [PATCH 4/4] memory: tegra-mc: Use %pe format
Quoted 9 lines · Krzysztof Kozlowski
Make code printing pointer error value a bit simpler and fix coccinelle suggestion:
tegra/mc.c:975:4-11: WARNING: Consider using %pe to print
PTR_ERR()Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/memory/tegra/mc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 5 lines · Krzysztof Kozlowski
Few cleanups for Renesas and Tegra.
Best regards,
Krzysztof
Applied, thanks!
[1/4] memory: renesas-rpc-if: Simplify printing PTR_ERR with dev_err_probe
https://git.kernel.org/krzk/linux-mem-ctrl/c/8a39b1d4b358f8ccae29166e239f4dd2594b2e7c [2/4] memory: tegra-mc: Drop tegra_mc_setup_latency_allowance() return value https://git.kernel.org/krzk/linux-mem-ctrl/c/2ac5ba4c50be535497dc01089e4113185e4ccad1 [3/4] memory: tegra-mc: Simplify printing PTR_ERR with dev_err_probe https://git.kernel.org/krzk/linux-mem-ctrl/c/f7bd985ad907ed85999f4bac4870abe35dcd2745 [4/4] memory: tegra-mc: Use %pe format https://git.kernel.org/krzk/linux-mem-ctrl/c/2413283fac5b2975f5ead6a1dcac7d5c6f7366d8
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>