Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / nvmem / zynqmp_nvmem.c
index 490c8fc..5893543 100644 (file)
@@ -16,6 +16,8 @@ struct zynqmp_nvmem_data {
        struct nvmem_device *nvmem;
 };
 
+static const struct zynqmp_eemi_ops *eemi_ops;
+
 static int zynqmp_nvmem_read(void *context, unsigned int offset,
                             void *val, size_t bytes)
 {
@@ -23,9 +25,7 @@ static int zynqmp_nvmem_read(void *context, unsigned int offset,
        int idcode, version;
        struct zynqmp_nvmem_data *priv = context;
 
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
-
-       if (!eemi_ops || !eemi_ops->get_chipid)
+       if (!eemi_ops->get_chipid)
                return -ENXIO;
 
        ret = eemi_ops->get_chipid(&idcode, &version);
@@ -61,6 +61,10 @@ static int zynqmp_nvmem_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       eemi_ops = zynqmp_pm_get_eemi_ops();
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
+
        priv->dev = dev;
        econfig.dev = dev;
        econfig.reg_read = zynqmp_nvmem_read;