From 8cc184401eff69300592f1dfa194a689322ec0dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sun, 17 Jan 2021 23:19:52 +0100
Subject: [PATCH 297/463] i2c: mv64xxx: Don't make a fuss when pinctrl recovery
 state is not present

Otherwise dmesg log presents a useless error.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 29f94efedf605..89a794e30e962 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -950,6 +950,14 @@ static int mv64xxx_i2c_init_recovery_info(struct mv64xxx_i2c_data *drv_data,
 		return -ENODEV;
 	}
 
+	if (IS_ERR(pinctrl_lookup_state(rinfo->pinctrl, "gpio")) &&
+		IS_ERR(pinctrl_lookup_state(rinfo->pinctrl, "recovery"))) {
+		/* No recovery state is vailable in pinctrl. */
+		devm_pinctrl_put(rinfo->pinctrl);
+		rinfo->pinctrl = NULL;
+		return 0;
+	}
+
 	drv_data->adapter.bus_recovery_info = rinfo;
 	return 0;
 }
-- 
2.46.0

