err = 0;
if (client == NULL) {
- dev_info(&client->dev, "client is NULL. exiting.\n");
+ pr_info("%s: i2c client is NULL. Device not accessible.\n",
+ __func__);
err = -ENODEV;
goto end;
}
}
platform_data = client->dev.platform_data;
+
+ if (!platform_data) {
+ dev_info(&client->dev, "chip not available\n");
+ err = -ENODEV;
+ goto _tpm_clean_answer;
+ }
+
platform_data->tpm_i2c_buffer[0] =
kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
if (platform_data->tpm_i2c_buffer[0] == NULL) {
tpm_get_timeouts(chip);
i2c_set_clientdata(client, chip);
- platform_data->bChipF = false;
dev_info(chip->dev, "TPM I2C Initialized\n");
return 0;
platform_data->tpm_i2c_buffer[0] = NULL;
_tpm_clean_answer:
tpm_remove_hardware(chip->dev);
- platform_data->bChipF = true;
end:
pr_info("TPM I2C initialisation fail\n");
return err;
gpio_free(pin_infos->io_serirq);
gpio_free(pin_infos->io_lpcpd);
- if (pin_infos->bChipF != true)
- tpm_remove_hardware(chip->dev);
+ tpm_remove_hardware(chip->dev);
+
if (pin_infos->tpm_i2c_buffer[1] != NULL) {
kzfree(pin_infos->tpm_i2c_buffer[1]);
pin_infos->tpm_i2c_buffer[1] = NULL;