summaryrefslogtreecommitdiffstats
path: root/drivers/fpga/dfl.c
diff options
context:
space:
mode:
authorWu Hao <hao.wu@intel.com>2019-08-12 04:49:56 +0200
committerMoritz Fischer <mdf@kernel.org>2019-09-04 04:35:40 +0200
commit84b693e3786b92d2e7bb9108ca187253ffd02115 (patch)
tree670a447bb15c4c2666ec1fa5398a9f8a222132d5 /drivers/fpga/dfl.c
parentMerge branch 'char-misc-next' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff)
downloadlinux-84b693e3786b92d2e7bb9108ca187253ffd02115.tar.xz
linux-84b693e3786b92d2e7bb9108ca187253ffd02115.zip
fpga: dfl: make init callback optional
This patch makes init callback of sub features optional. With this change, people don't need to prepare any empty init callback. Signed-off-by: Wu Hao <hao.wu@intel.com> Acked-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga/dfl.c')
-rw-r--r--drivers/fpga/dfl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index c0512afc4ed7..96a2b8274a33 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -271,11 +271,13 @@ static int dfl_feature_instance_init(struct platform_device *pdev,
struct dfl_feature *feature,
struct dfl_feature_driver *drv)
{
- int ret;
+ int ret = 0;
- ret = drv->ops->init(pdev, feature);
- if (ret)
- return ret;
+ if (drv->ops->init) {
+ ret = drv->ops->init(pdev, feature);
+ if (ret)
+ return ret;
+ }
feature->ops = drv->ops;