]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
firmware: ti_sci: Parse all resource ranges even if some is not available
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 6 Jun 2019 12:13:57 +0000 (15:13 +0300)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Thu, 13 Jun 2019 03:13:36 +0000 (20:13 -0700)
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>
drivers/firmware/ti_sci.c

index b47e33e7411fe9eeae88ec5823005584d85d2474..86b272751c52b1a04fd909e0a0553a7759e1f523 100644 (file)
@@ -3180,6 +3180,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                            struct device *dev, u32 dev_id, char *of_prop)
 {
        struct ti_sci_resource *res;
+       bool valid_set = false;
        u32 resource_subtype;
        int i, ret;
 
@@ -3210,15 +3211,18 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                                                        &res->desc[i].start,
                                                        &res->desc[i].num);
                if (ret) {
-                       dev_err(dev, "dev = %d subtype %d not allocated for this host\n",
+                       dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
                                dev_id, resource_subtype);
-                       return ERR_PTR(ret);
+                       res->desc[i].start = 0;
+                       res->desc[i].num = 0;
+                       continue;
                }
 
                dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
                        dev_id, resource_subtype, res->desc[i].start,
                        res->desc[i].num);
 
+               valid_set = true;
                res->desc[i].res_map =
                        devm_kzalloc(dev, BITS_TO_LONGS(res->desc[i].num) *
                                     sizeof(*res->desc[i].res_map), GFP_KERNEL);
@@ -3227,7 +3231,10 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
        }
        raw_spin_lock_init(&res->lock);
 
-       return res;
+       if (valid_set)
+               return res;
+
+       return ERR_PTR(-EINVAL);
 }
 
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,