Re: [PATCH v4 2/4] drm/xe/xe_drm_ras: Add support for drm ras

Raag Jadav
2026-01-28T07:15:36Z

On Wed, Jan 28, 2026 at 12:21:18PM +0530, Riana Tauro wrote:
> On 1/20/2026 10:31 PM, Raag Jadav wrote:
> > On Mon, Jan 19, 2026 at 09:30:24AM +0530, Riana Tauro wrote:
> > > Allocate correctable, uncorrectable nodes for every xe device
> > > Each node contains error classes, counters and respective
> > > query counter functions.
> >
> > ...
> >
> > > +static int hw_query_error_counter(struct xe_drm_ras_counter *info,
> > > + u32 error_id, const char **name, u32 *val)
> > > +{
> > > + if (error_id < DRM_XE_RAS_ERROR_CLASS_GT || error_id >= DRM_XE_RAS_ERROR_CLASS_MAX)
> >
> > This looks like it can be in_range().
>
> in_range has start+len. Should again use count here.
> This seems simpler

I just had another look at this and wondering if we really need lower
bound check? error_id is already unsigned right?

Raag

> > > + return -EINVAL;
> > > +
> > > + if (!info[error_id].name)
> > > + return -ENOENT;
> > > +
> > > + *name = info[error_id].name;
> > > + *val = atomic64_read(&info[error_id].counter);
> > > +
> > > + return 0;
> > > +}