Commit b3245f70 authored by Peter Colberg's avatar Peter Colberg Committed by Xu Yilun
Browse files

fpga: dfl: convert features from flexible array member to separate array



Use a separate array allocation for features and substitute a pointer
for the flexible array member in the feature device data. A subsequent
commit will add another array for resources. The current commit converts
the flexible array member to a separate allocation for consistency.

Signed-off-by: default avatarPeter Colberg <peter.colberg@intel.com>
Reviewed-by: default avatarMatthew Gerlach <matthew.gerlach@linux.intel.com>
Reviewed-by: default avatarBasheer Ahmed Muddebihal <basheer.ahmed.muddebihal@linux.intel.com>
Acked-by: default avatarXu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20241120011035.230574-12-peter.colberg@intel.com


Signed-off-by: default avatarXu Yilun <yilun.xu@linux.intel.com>
parent 39ea74e3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -752,10 +752,15 @@ binfo_create_feature_dev_data(struct build_feature_devs_info *binfo)
	if (WARN_ON_ONCE(type >= DFL_ID_MAX))
		return ERR_PTR(-EINVAL);

	fdata = devm_kzalloc(binfo->dev, struct_size(fdata, features, binfo->feature_num), GFP_KERNEL);
	fdata = devm_kzalloc(binfo->dev, sizeof(*fdata), GFP_KERNEL);
	if (!fdata)
		return ERR_PTR(-ENOMEM);

	fdata->features = devm_kcalloc(binfo->dev, binfo->feature_num,
				       sizeof(*fdata->features), GFP_KERNEL);
	if (!fdata->features)
		return ERR_PTR(-ENOMEM);

	fdata->dev = fdev;
	fdata->type = type;
	fdata->num = binfo->feature_num;
+1 −1
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ struct dfl_feature_dev_data {
	int open_count;
	void *private;
	int num;
	struct dfl_feature features[];
	struct dfl_feature *features;
};

/**