Commit 1cddd3e4 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Greg Kroah-Hartman

nvmem: check the return value of nvmem_add_cells()

[ Upstream commit fa72d847 ]

This function can fail so check its return value in nvmem_register()
and act accordingly.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7087a37
...@@ -516,11 +516,17 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) ...@@ -516,11 +516,17 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
goto err_device_del; goto err_device_del;
} }
if (config->cells) if (config->cells) {
nvmem_add_cells(nvmem, config->cells, config->ncells); rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
if (rval)
goto err_teardown_compat;
}
return nvmem; return nvmem;
err_teardown_compat:
if (config->compat)
device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
err_device_del: err_device_del:
device_del(&nvmem->dev); device_del(&nvmem->dev);
err_put_device: err_put_device:
......
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