Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[firefly-linux-kernel-4.4.55.git] / drivers / char / tpm / tpm_i2c_infineon.c
index bd9a2958dc39e19382bdf9efd85672356f626d43..37d5dcc10ea75882d0aec906bab00962583ca165 100644 (file)
@@ -162,6 +162,10 @@ out:
        /* take care of 'guard time' */
        usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
 
+       /* __i2c_transfer returns the number of successfully transferred
+        * messages.
+        * So rc should be greater than 0 here otherwise we have an error.
+        */
        if (rc <= 0)
                return -EIO;
 
@@ -208,6 +212,11 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
        i2c_unlock_adapter(tpm_dev.client->adapter);
        /* take care of 'guard time' */
        usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
+
+       /* __i2c_transfer returns the number of successfully transferred
+        * messages.
+        * So rc should be greater than 0 here otherwise we have an error.
+        */
        if (rc <= 0)
                return -EIO;
 
@@ -694,9 +703,24 @@ MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_table);
 
 #ifdef CONFIG_OF
 static const struct of_device_id tpm_tis_i2c_of_match[] = {
-       { .compatible = "infineon,tpm_i2c_infineon", .data = (void *)0 },
-       { .compatible = "infineon,slb9635tt", .data = (void *)0 },
-       { .compatible = "infineon,slb9645tt", .data = (void *)1 },
+       {
+               .name = "tpm_i2c_infineon",
+               .type = "tpm",
+               .compatible = "infineon,tpm_i2c_infineon",
+               .data = (void *)0
+       },
+       {
+               .name = "slb9635tt",
+               .type = "tpm",
+               .compatible = "infineon,slb9635tt",
+               .data = (void *)0
+       },
+       {
+               .name = "slb9645tt",
+               .type = "tpm",
+               .compatible = "infineon,slb9645tt",
+               .data = (void *)1
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, tpm_tis_i2c_of_match);