summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2019-06-06 08:13:57 -0400
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>2019-06-12 23:13:36 -0400
commitfa42da11b285d720af5ccb1a305e76feab26c879 (patch)
tree79668b9eba4bbce94e5af1671ee89042f7cdd848 /drivers/firmware
parent1e407f337f4015c8ffc56e7cfd70e06b2e9fc9da (diff)
firmware: ti_sci: Parse all resource ranges even if some is not available
Do not fail if any of the requested subtypes are not availabe, but set the number of resources to 0 and continue parsing the resource ranges. Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/ti_sci.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index b47e33e7411f..86b272751c52 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3180,6 +3180,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
3180 struct device *dev, u32 dev_id, char *of_prop) 3180 struct device *dev, u32 dev_id, char *of_prop)
3181{ 3181{
3182 struct ti_sci_resource *res; 3182 struct ti_sci_resource *res;
3183 bool valid_set = false;
3183 u32 resource_subtype; 3184 u32 resource_subtype;
3184 int i, ret; 3185 int i, ret;
3185 3186
@@ -3210,15 +3211,18 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
3210 &res->desc[i].start, 3211 &res->desc[i].start,
3211 &res->desc[i].num); 3212 &res->desc[i].num);
3212 if (ret) { 3213 if (ret) {
3213 dev_err(dev, "dev = %d subtype %d not allocated for this host\n", 3214 dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
3214 dev_id, resource_subtype); 3215 dev_id, resource_subtype);
3215 return ERR_PTR(ret); 3216 res->desc[i].start = 0;
3217 res->desc[i].num = 0;
3218 continue;
3216 } 3219 }
3217 3220
3218 dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n", 3221 dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
3219 dev_id, resource_subtype, res->desc[i].start, 3222 dev_id, resource_subtype, res->desc[i].start,
3220 res->desc[i].num); 3223 res->desc[i].num);
3221 3224
3225 valid_set = true;
3222 res->desc[i].res_map = 3226 res->desc[i].res_map =
3223 devm_kzalloc(dev, BITS_TO_LONGS(res->desc[i].num) * 3227 devm_kzalloc(dev, BITS_TO_LONGS(res->desc[i].num) *
3224 sizeof(*res->desc[i].res_map), GFP_KERNEL); 3228 sizeof(*res->desc[i].res_map), GFP_KERNEL);
@@ -3227,7 +3231,10 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
3227 } 3231 }
3228 raw_spin_lock_init(&res->lock); 3232 raw_spin_lock_init(&res->lock);
3229 3233
3230 return res; 3234 if (valid_set)
3235 return res;
3236
3237 return ERR_PTR(-EINVAL);
3231} 3238}
3232 3239
3233static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode, 3240static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,