Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wu Hao and committed by
Moritz Fischer
84b693e3 af9ca4b0

+6 -4
+6 -4
drivers/fpga/dfl.c
··· 271 271 struct dfl_feature *feature, 272 272 struct dfl_feature_driver *drv) 273 273 { 274 - int ret; 274 + int ret = 0; 275 275 276 - ret = drv->ops->init(pdev, feature); 277 - if (ret) 278 - return ret; 276 + if (drv->ops->init) { 277 + ret = drv->ops->init(pdev, feature); 278 + if (ret) 279 + return ret; 280 + } 279 281 280 282 feature->ops = drv->ops; 281 283