]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/fpga/xilinx.c
Merge branch 'master' of git://git.denx.de/u-boot-atmel
[karo-tx-uboot.git] / drivers / fpga / xilinx.c
index 3795c1aff6e267640c4ef869c0e344c52e3b9f93..c765a74a25e0f17895b8010cfcbb646f735a5093 100644 (file)
@@ -139,6 +139,11 @@ int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize,
                return FPGA_FAIL;
        }
 
+       if (!desc->operations || !desc->operations->load) {
+               printf("%s: Missing load operation\n", __func__);
+               return FPGA_FAIL;
+       }
+
        return desc->operations->load(desc, buf, bsize, bstype);
 }
 
@@ -151,8 +156,10 @@ int xilinx_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,
                return FPGA_FAIL;
        }
 
-       if (!desc->operations->loadfs)
+       if (!desc->operations || !desc->operations->loadfs) {
+               printf("%s: Missing loadfs operation\n", __func__);
                return FPGA_FAIL;
+       }
 
        return desc->operations->loadfs(desc, buf, bsize, fpga_fsinfo);
 }
@@ -165,6 +172,11 @@ int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize)
                return FPGA_FAIL;
        }
 
+       if (!desc->operations || !desc->operations->dump) {
+               printf("%s: Missing dump operation\n", __func__);
+               return FPGA_FAIL;
+       }
+
        return desc->operations->dump(desc, buf, bsize);
 }
 
@@ -220,18 +232,20 @@ int xilinx_info(xilinx_desc *desc)
                        printf ("Unsupported interface type, %d\n", desc->iface);
                }
 
-               printf ("Device Size:   \t%d bytes\n"
-                               "Cookie:        \t0x%x (%d)\n",
-                               desc->size, desc->cookie, desc->cookie);
+               printf("Device Size:   \t%zd bytes\n"
+                      "Cookie:        \t0x%x (%d)\n",
+                      desc->size, desc->cookie, desc->cookie);
                if (desc->name)
                        printf("Device name:   \t%s\n", desc->name);
 
-               if (desc->iface_fns) {
+               if (desc->iface_fns)
                        printf ("Device Function Table @ 0x%p\n", desc->iface_fns);
-                       desc->operations->info(desc);
-               } else
+               else
                        printf ("No Device Function Table.\n");
 
+               if (desc->operations && desc->operations->info)
+                       desc->operations->info(desc);
+
                ret_val = FPGA_SUCCESS;
        } else {
                printf ("%s: Invalid device descriptor\n", __FUNCTION__);