Commit 3ecfea2d authored by Federico Vaga's avatar Federico Vaga

fmc: fix removal procedure

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 4b4d4c6b
......@@ -229,17 +229,19 @@ int fmc_slot_eeprom_add(struct fmc_slot *slot)
*/
void fmc_slot_eeprom_del(struct fmc_slot *slot)
{
if (!slot)
return;
#if KERNEL_VERSION(5, 1, 0) <= LINUX_VERSION_CODE
nvmem_device_put(slot->nvmem);
slot->nvmem = NULL;
if (slot->nvmem) {
nvmem_device_put(slot->nvmem);
slot->nvmem = NULL;
}
#endif
if (!slot || !slot->eeprom)
return;
sysfs_remove_link(&slot->dev.kobj, FRU_EEPROM_NAME);
i2c_unregister_device(slot->eeprom);
slot->eeprom = NULL;
if (slot->eeprom) {
sysfs_remove_link(&slot->dev.kobj, FRU_EEPROM_NAME);
i2c_unregister_device(slot->eeprom);
slot->eeprom = NULL;
}
#if KERNEL_VERSION(4, 6, 0) > LINUX_VERSION_CODE
slot->macc = NULL;
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment