mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 19:21:17 +07:00
nvmem: check the return value of nvmem_add_cells()
This function can fail so check its return value in nvmem_register() and act accordingly. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f9fcb7e36c
commit
fa72d847d6
@ -512,11 +512,17 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
|
||||
goto err_device_del;
|
||||
}
|
||||
|
||||
if (config->cells)
|
||||
nvmem_add_cells(nvmem, config->cells, config->ncells);
|
||||
if (config->cells) {
|
||||
rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
|
||||
if (rval)
|
||||
goto err_teardown_compat;
|
||||
}
|
||||
|
||||
return nvmem;
|
||||
|
||||
err_teardown_compat:
|
||||
if (config->compat)
|
||||
device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
|
||||
err_device_del:
|
||||
device_del(&nvmem->dev);
|
||||
err_put_device:
|
||||
|
Loading…
Reference in New Issue
Block a user