[Intel-gfx] [PATCH v3 1/2] drm/i915/gt: Split intel-gtt functions by arch

Casey Bowman casey.g.bowman at intel.com
Wed Mar 30 16:32:55 UTC 2022



On 3/30/22 03:16, Jani Nikula wrote:
> On Tue, 29 Mar 2022, Casey Bowman <casey.g.bowman at intel.com> wrote:
>> +/* Stubs for non-x86 platforms */
>> +#else
>> +static inline void intel_gt_gmch_gen5_chipset_flush(struct intel_gt *gt)
>> +{
>> +}
>> +static inline int intel_gt_gmch_gen5_probe(struct i915_ggtt *ggtt)
>> +{
>> +	/* No HW should be probed for this case yet, return fail */
>> +	return -1;
>> +}
>> +static inline int intel_gt_gmch_gen6_probe(struct i915_ggtt *ggtt)
>> +{
>> +	/* No HW should be probed for this case yet, return fail */
>> +	return -1;
>> +}
>> +static inline int intel_gt_gmch_gen8_probe(struct i915_ggtt *ggtt)
>> +{
>> +	/* No HW should be probed for this case yet, return fail */
>> +	return -1;
>> +}
>> +static inline int intel_gt_gmch_gen5_enable_hw(struct drm_i915_private *i915)
>> +{
>> +	/* No HW should be enabled for this case yet, return fail */
>> +	return -1;
>> +}
>> +#endif
> Never use magic -1 for negative errno returns. That's -EPERM and not
> what you mean. -ENODEV or -EINVAL are better here.
>
> (As an exception, returning -1 is *maybe* fine for functions that return
> an index or something, and have zero chance of propagating to somewhere
> that actually interprets the number as a negative errno.)
>
> BR,
> Jani.
>

Thanks for pointing this out, the error codes slipped my mind when
creating these stubs. I'll fix that.

Regards,
Casey


More information about the Intel-gfx mailing list