In the function tpm_register_hardware there is this condition... if (chip->dev_num >= TPM_NUM_DEVICES) { dev_err(dev, "No available tpm device numbers\n"); kfree(chip); return NULL; } Before the return, devname should be kfree'd
Shouldn't all of the "return NULL" locations also free chip and devname?
Created attachment 17680 [details] Relesae memory on init failure.