clk: versaclock7: Fix an error handling path in vc7_probe()

Message ID 68c2fac5e774088437200aaeca8737a691bf951c.1679842132.git.christophe.jaillet@wanadoo.fr
State New
Headers
Series clk: versaclock7: Fix an error handling path in vc7_probe() |

Commit Message

Christophe JAILLET March 26, 2023, 2:49 p.m. UTC
  If an error code other than -EPROBE_DEFER is returned, it is likely that
there will be some trouble when:
   __clk_get_name(vc7->pin_xin)
is called a few lines below.

__clk_get_name() only checks for NULL.

Fixes: 48c5e98fedd9 ("clk: Renesas versaclock7 ccf device driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative and compile tested only.
---
 drivers/clk/clk-versaclock7.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/clk/clk-versaclock7.c b/drivers/clk/clk-versaclock7.c
index 8e4f86e852aa..8d11e68e94b2 100644
--- a/drivers/clk/clk-versaclock7.c
+++ b/drivers/clk/clk-versaclock7.c
@@ -1111,8 +1111,8 @@  static int vc7_probe(struct i2c_client *client)
 	vc7->chip_info = of_device_get_match_data(&client->dev);
 
 	vc7->pin_xin = devm_clk_get(&client->dev, "xin");
-	if (PTR_ERR(vc7->pin_xin) == -EPROBE_DEFER) {
-		return dev_err_probe(&client->dev, -EPROBE_DEFER,
+	if (IS_ERR(vc7->pin_xin)) {
+		return dev_err_probe(&client->dev, PTR_ERR(vc7->pin_xin),
 				     "xin not specified\n");
 	}