[PATCH 10/13] clk: imx: composite-8m: convert compute_dividers to void

Benjamin Bara bbara93 at gmail.com
Sun Sep 17 15:40:06 PDT 2023


From: Benjamin Bara <benjamin.bara at skidata.com>

As the current implementation cannot fail, drop the return value.

Signed-off-by: Benjamin Bara <benjamin.bara at skidata.com>
---
 drivers/clk/imx/clk-composite-8m.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index 27a08c50ac1d..a121f1285110 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -47,13 +47,12 @@ static unsigned long imx8m_clk_composite_divider_recalc_rate(struct clk_hw *hw,
 				   divider->flags, PCG_DIV_WIDTH);
 }
 
-static int imx8m_clk_composite_compute_dividers(unsigned long rate,
+static void imx8m_clk_composite_compute_dividers(unsigned long rate,
 						unsigned long parent_rate,
 						int *prediv, int *postdiv)
 {
 	int div1, div2;
 	int error = INT_MAX;
-	int ret = -EINVAL;
 
 	*prediv = 1;
 	*postdiv = 1;
@@ -66,11 +65,9 @@ static int imx8m_clk_composite_compute_dividers(unsigned long rate,
 				*prediv = div1;
 				*postdiv = div2;
 				error = new_error;
-				ret = 0;
 			}
 		}
 	}
-	return ret;
 }
 
 static long imx8m_clk_composite_divider_round_rate(struct clk_hw *hw,
@@ -80,8 +77,8 @@ static long imx8m_clk_composite_divider_round_rate(struct clk_hw *hw,
 	int prediv_value;
 	int div_value;
 
-	imx8m_clk_composite_compute_dividers(rate, *prate,
-						&prediv_value, &div_value);
+	imx8m_clk_composite_compute_dividers(rate, *prate, &prediv_value,
+					     &div_value);
 	rate = DIV_ROUND_UP(*prate, prediv_value);
 
 	return DIV_ROUND_UP(rate, div_value);
@@ -96,13 +93,10 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
 	unsigned long flags;
 	int prediv_value;
 	int div_value;
-	int ret;
 	u32 orig, val;
 
-	ret = imx8m_clk_composite_compute_dividers(rate, parent_rate,
-						&prediv_value, &div_value);
-	if (ret)
-		return -EINVAL;
+	imx8m_clk_composite_compute_dividers(rate, parent_rate,	&prediv_value,
+					     &div_value);
 
 	spin_lock_irqsave(divider->lock, flags);
 
@@ -118,7 +112,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
 
 	spin_unlock_irqrestore(divider->lock, flags);
 
-	return ret;
+	return 0;
 }
 
 static int imx8m_divider_determine_rate(struct clk_hw *hw,

-- 
2.34.1




More information about the linux-arm-kernel mailing list