@@ -291,24 +291,26 @@ static struct sht3x_data *sht3x_update_client(struct device *dev)
291291 return data ;
292292}
293293
294- static int temp1_input_read (struct device * dev )
294+ static int temp1_input_read (struct device * dev , long * temp )
295295{
296296 struct sht3x_data * data = sht3x_update_client (dev );
297297
298298 if (IS_ERR (data ))
299299 return PTR_ERR (data );
300300
301- return data -> temperature ;
301+ * temp = data -> temperature ;
302+ return 0 ;
302303}
303304
304- static int humidity1_input_read (struct device * dev )
305+ static int humidity1_input_read (struct device * dev , long * humidity )
305306{
306307 struct sht3x_data * data = sht3x_update_client (dev );
307308
308309 if (IS_ERR (data ))
309310 return PTR_ERR (data );
310311
311- return data -> humidity ;
312+ * humidity = data -> humidity ;
313+ return 0 ;
312314}
313315
314316/*
@@ -706,6 +708,7 @@ static int sht3x_read(struct device *dev, enum hwmon_sensor_types type,
706708 u32 attr , int channel , long * val )
707709{
708710 enum sht3x_limits index ;
711+ int ret ;
709712
710713 switch (type ) {
711714 case hwmon_chip :
@@ -720,10 +723,12 @@ static int sht3x_read(struct device *dev, enum hwmon_sensor_types type,
720723 case hwmon_temp :
721724 switch (attr ) {
722725 case hwmon_temp_input :
723- * val = temp1_input_read (dev );
724- break ;
726+ return temp1_input_read (dev , val );
725727 case hwmon_temp_alarm :
726- * val = temp1_alarm_read (dev );
728+ ret = temp1_alarm_read (dev );
729+ if (ret < 0 )
730+ return ret ;
731+ * val = ret ;
727732 break ;
728733 case hwmon_temp_max :
729734 index = limit_max ;
@@ -748,10 +753,12 @@ static int sht3x_read(struct device *dev, enum hwmon_sensor_types type,
748753 case hwmon_humidity :
749754 switch (attr ) {
750755 case hwmon_humidity_input :
751- * val = humidity1_input_read (dev );
752- break ;
756+ return humidity1_input_read (dev , val );
753757 case hwmon_humidity_alarm :
754- * val = humidity1_alarm_read (dev );
758+ ret = humidity1_alarm_read (dev );
759+ if (ret < 0 )
760+ return ret ;
761+ * val = ret ;
755762 break ;
756763 case hwmon_humidity_max :
757764 index = limit_max ;
0 commit comments