max1720x_battery: race in max1720x_get_model_data()

Solve a race during boot where power_supply_uevent() read
max_m5_read_actual_input_current_ua() before the FG is
initialized.

test for NULL in max1720x_get_model_data.

Bug: 169092265
Test: reboot check logs
Signed-off-by: AleX Pelosi <[email protected]>
Change-Id: I80b92ee9ebd914e26282d066ae38952442e51a8c
diff --git a/max1720x_battery.c b/max1720x_battery.c
index f08bd66..6e70061 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -4089,10 +4089,12 @@
 	return ret;
 }
 
+/* possible race */
 void *max1720x_get_model_data(struct i2c_client *client)
 {
 	struct max1720x_chip *chip = i2c_get_clientdata(client);
-	return chip->model_data;
+
+	return chip ? chip->model_data : NULL;
 }
 
 static int max1720x_probe(struct i2c_client *client,