Commit b093b55f authored by Federico Vaga's avatar Federico Vaga Committed by Vaibhav Gupta

drivers: fmc-eeprom: Reset the pointer on error.

On error, set the slot->nvmem to NULL. This keeps the data structure in
line with the real status (the nvmem device was not found).

Reported by: Federico Vaga <federico.vaga@cern.ch>
Signed-off-by: 's avatarVaibhav Gupta <vaibhav.gupta@cern.ch>
parent 69033a9d
...@@ -189,8 +189,11 @@ static int __fmc_slot_eeprom_add(struct fmc_slot *slot, ...@@ -189,8 +189,11 @@ static int __fmc_slot_eeprom_add(struct fmc_slot *slot,
"%s", dev_name(&slot->eeprom->dev)); "%s", dev_name(&slot->eeprom->dev));
slot->nvmem = nvmem_device_find(nvmem_parent_name, slot->nvmem = nvmem_device_find(nvmem_parent_name,
fmc_nvmem_device_find_match); fmc_nvmem_device_find_match);
if (IS_ERR_OR_NULL(slot->nvmem)) if (IS_ERR_OR_NULL(slot->nvmem)) {
return PTR_ERR(slot->nvmem); int err = PTR_ERR(slot->nvmem)
slot->nvmem = NULL;
return err;
}
kfree(nvmem_parent_name); kfree(nvmem_parent_name);
#endif #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