Commit 5c4cee2f authored by Alex Elder's avatar Alex Elder Committed by Matt Porter

ARM: bcm: err, don't BUG() on SMC init failures

Several conditions in bcm_kona_smc_init() are handled with BUG_ON().
That function is capable of returning an error, so do that instead.

Also, don't assume of_get_address() returns a valid pointer.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarTim Kryger <tim.kryger@linaro.org>
Reviewed-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
Reviewed-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
parent e80eef33
...@@ -45,6 +45,7 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = { ...@@ -45,6 +45,7 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
int __init bcm_kona_smc_init(void) int __init bcm_kona_smc_init(void)
{ {
struct device_node *node; struct device_node *node;
const __be32 *prop_val;
/* Read buffer addr and size from the device tree node */ /* Read buffer addr and size from the device tree node */
node = of_find_matching_node(NULL, bcm_kona_smc_ids); node = of_find_matching_node(NULL, bcm_kona_smc_ids);
...@@ -52,12 +53,17 @@ int __init bcm_kona_smc_init(void) ...@@ -52,12 +53,17 @@ int __init bcm_kona_smc_init(void)
return -ENODEV; return -ENODEV;
/* Don't care about size or flags of the DT node */ /* Don't care about size or flags of the DT node */
bridge_data.buffer_addr = prop_val = of_get_address(node, 0, NULL, NULL);
be32_to_cpu(*of_get_address(node, 0, NULL, NULL)); if (!prop_val)
BUG_ON(!bridge_data.buffer_addr); return -EINVAL;
bridge_data.buffer_addr = be32_to_cpu(*prop_val);
if (!bridge_data.buffer_addr)
return -EINVAL;
bridge_data.bounce = of_iomap(node, 0); bridge_data.bounce = of_iomap(node, 0);
BUG_ON(!bridge_data.bounce); if (!bridge_data.bounce)
return -ENOMEM;
bridge_data.initialized = 1; bridge_data.initialized = 1;
......
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