+static ssize_t amc_alert_reason_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev)); + struct xe_amc *amc = xe->i2c->amc; + u8 alert_reason; + + if (!amc->alert_seen)[Severity: Medium] Could this read of amc->alert_seen cause a data race? The sysfs reader relies on this boolean flag to decide whether to read alert_reason, but it lacks memory barriers or READ_ONCE(). A concurrent sysfs reader might observe an inconsistent state here while a new alert is being processed.
alert_seen
is not intended as a synchronization mechanism. It only
distinguishes the initial state where no AMC alert has been
received. The
sysfs attribute is expected to be queried after the device is
declared wedged, by which point the alert state has already been
recorded.