mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	Input: iqs5xx - preserve bootloader errors
After user space writes the fw_file attribute to push new firmware to the device, the driver calls iqs5xx_dev_init() to re-initialize the device with the updated firmware or recover the device in case the update failed. In the case of the latter, however, iqs5xx_fw_file_write() returns zero (success) so long as iqs5xx_dev_init() does not fail, and any error encountered during the update process is lost. Solve this by saving the error before calling iqs5xx_dev_init(). Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-3-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
		
							parent
							
								
									785a19d97c
								
							
						
					
					
						commit
						2539da6677
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -883,7 +883,7 @@ static int iqs5xx_fw_file_parse(struct i2c_client *client,
 | 
				
			||||||
static int iqs5xx_fw_file_write(struct i2c_client *client, const char *fw_file)
 | 
					static int iqs5xx_fw_file_write(struct i2c_client *client, const char *fw_file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct iqs5xx_private *iqs5xx = i2c_get_clientdata(client);
 | 
						struct iqs5xx_private *iqs5xx = i2c_get_clientdata(client);
 | 
				
			||||||
	int error;
 | 
						int error, error_bl;
 | 
				
			||||||
	u8 *pmap;
 | 
						u8 *pmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (iqs5xx->bl_status == IQS5XX_BL_STATUS_NONE)
 | 
						if (iqs5xx->bl_status == IQS5XX_BL_STATUS_NONE)
 | 
				
			||||||
| 
						 | 
					@ -937,6 +937,7 @@ static int iqs5xx_fw_file_write(struct i2c_client *client, const char *fw_file)
 | 
				
			||||||
		usleep_range(10000, 10100);
 | 
							usleep_range(10000, 10100);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						error_bl = error;
 | 
				
			||||||
	error = iqs5xx_dev_init(client);
 | 
						error = iqs5xx_dev_init(client);
 | 
				
			||||||
	if (!error && iqs5xx->bl_status == IQS5XX_BL_STATUS_RESET)
 | 
						if (!error && iqs5xx->bl_status == IQS5XX_BL_STATUS_RESET)
 | 
				
			||||||
		error = -EINVAL;
 | 
							error = -EINVAL;
 | 
				
			||||||
| 
						 | 
					@ -948,6 +949,9 @@ static int iqs5xx_fw_file_write(struct i2c_client *client, const char *fw_file)
 | 
				
			||||||
err_kfree:
 | 
					err_kfree:
 | 
				
			||||||
	kfree(pmap);
 | 
						kfree(pmap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (error_bl)
 | 
				
			||||||
 | 
							return error_bl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return error;
 | 
						return error;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue