[PATCH v2 3/3] firmware: zynqmp: Remove extraordinary return value

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Wed Apr 19 11:04:17 CEST 2023


From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

Return a common -EACCES error value instead of a positive private error
value XST_PM_NO_ACCESS (2002) in zynqmp_pmufw_load_config_object
function if the config object is not loadable to simplify the error
checking.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
---

Changes in v2:
- Use macro for node id

 drivers/firmware/firmware-zynqmp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index e763c639f7..7be4420a23 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -83,7 +83,7 @@ int zynqmp_pmufw_node(u32 id)
        ret = zynqmp_pmufw_load_config_object(xpm_configobject,
                                              sizeof(xpm_configobject));

-       if (ret == XST_PM_NO_ACCESS && id == PMUFW_CFG_OBJ_SUPPORT_NODE)
+       if (ret == -EACCES && id == PMUFW_CFG_OBJ_SUPPORT_NODE)
                skip_config = true;

        return 0;
@@ -236,8 +236,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
  *
  * @cfg_obj: Pointer to the configuration object
  * @size:    Size of @cfg_obj in bytes
- * Return:   0 on success otherwise negative errno. If the config object
- *           is not loadable returns positive errno XST_PM_NO_ACCESS(2002)
+ * Return:   0 on success otherwise negative errno.
  */
 int zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)
 {
@@ -254,10 +253,8 @@ int zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)
        if (err == XST_PM_NO_ACCESS) {
                u32 id = ((u32 *)cfg_obj)[NODE_ID_LOCATION];

-               if (id != PMUFW_CFG_OBJ_SUPPORT_NODE) {
+               if (id != PMUFW_CFG_OBJ_SUPPORT_NODE)
                        printf("PMUFW:  No permission to change config object\n");
-                       return err;
-               }
                return -EACCES;
        }

--
2.30.2

________________________________
Kommanditgesellschaft - Sitz: Detmold - Amtsgericht Lemgo HRA 2790 -
Komplementärin: Weidmüller Interface Führungsgesellschaft mbH -
Sitz: Detmold - Amtsgericht Lemgo HRB 3924;
Geschäftsführer: Dr. Timo Berger, Volker Bibelhausen, Dr. Sebastian Durst, André Sombecki;
USt-ID-Nr. DE124599660


More information about the U-Boot mailing list