aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_i2c_stm_st33.c
Commit message (Collapse)AuthorAge
* tpm/tpm_i2c_stm_st33: Check return code of get_burstcountPeter Huewe2014-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | commit 85c5e0d451125c6ddb78663972e40af810b83644 upstream. The 'get_burstcount' function can in some circumstances 'return -EBUSY' which in tpm_stm_i2c_send is stored in an 'u32 burstcnt' thus converting the signed value into an unsigned value, resulting in 'burstcnt' being huge. Changing the type to u32 only does not solve the problem as the signed value is converted to an unsigned in I2C_WRITE_DATA, resulting in the same effect. Thus -> Change type of burstcnt to u32 (the return type of get_burstcount) -> Add a check for the return value of 'get_burstcount' and propagate a potential error. This makes also sense in the 'I2C_READ_DATA' case, where the there is no signed/unsigned conversion. found by coverity Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tpm_i2c_stm_st33: Remove duplicate inclusion of header filesSachin Kamat2013-04-12
| | | | | | | module.h and sched.h were included twice. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm/tpm_i2c_stm_st33: formatting and white space changesPeter Huewe2013-04-12
| | | | | Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: drop temporary variable for return valuePeter Huewe2013-02-05
| | | | | | | | We don't need a temporary variable just to store the return value which gets return in the next statement. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: remove dead assignment in tpm_st33_i2c_probePeter Huewe2013-02-05
| | | | | | | | | Err is never read before it is assigned again -> remove the dead assigment. Found with clang static analyzer Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: Remove __devexit attributePeter Huewe2013-02-05
| | | | | | | With the HOTPLUG changes 3.8 this attribute is going away. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignmentPeter Huewe2013-02-05
| | | | | | | | | We don't need to call memcpy for one byte, but assign it directly. And to make the offset clearer we use the array syntax on the subsequent call to memset to make the relationship clearer. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm_i2c_stm_st33: removed unused variables/codeKent Yoder2013-02-05
| | | | | | Reported-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm: Fix cancellation of TPM commands (polling mode)Stefan Berger2013-02-05
| | | | | | | | | | | | | | | | On one of my machines the cancellation of TPM commands does not work. The reason is that by writing into sysfs 'cancel' the tpm_tis_ready call causes the status flag TPM_STS_VALID to be set in the statusregister. However, the TIS driver seems to wait for TPM_STS_COMMAND_READY. Once a 2nd time sysfs 'cancel' is written to, the TPM_STS_COMMAND_READY flag also gets set, resulting in TPM_STS_VALID|TPM_STS_COMMAND_READY to be read from the status register. This patch now converts req_canceled into a function to enable more complex comparisons against possible cancellation status codes. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm_i2c_stm_st33: fix oops when i2c client is unavailableKent Yoder2013-02-05
| | | | | | | | | | | | | When no i2c bus exists, user-space can cause an oops by triggering a device probe through a message sent to an i2c "new_device" sysfs entry. Adding a check for a NULL i2c client structure in the probe function closes the hole. This patch also fixes accessing the NULL client struct in the print function call reporting the error. Reported-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm: Use struct dev_pm_ops for power managementPeter Huewe2013-02-05
| | | | | | | | This patch converts the suspend and resume functions for tpm_i2c_stm_st33 to the new dev_pm_ops. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm: rename STM driver to match other i2c driversKent Yoder2013-02-05
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>