mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	misc/ics932s401: Add a missing check to i2c_smbus_read_word_data
ics932s401_update_device may fail reading in i2c_smbus_read_word_data due to error in i2c_smbus_xfer. The fix checks the status and defaults the register to 0. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
							parent
							
								
									068ad41ec5
								
							
						
					
					
						commit
						b05ae01fdb
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -146,6 +146,8 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev)
 | 
			
		|||
	 */
 | 
			
		||||
	for (i = 0; i < NUM_MIRRORED_REGS; i++) {
 | 
			
		||||
		temp = i2c_smbus_read_word_data(client, regs_to_copy[i]);
 | 
			
		||||
		if (temp < 0)
 | 
			
		||||
			data->regs[regs_to_copy[i]] = 0;
 | 
			
		||||
		data->regs[regs_to_copy[i]] = temp >> 8;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue