struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
struct cti_config *config = &drvdata->config;
+ if (reg_offset < 0)
+ return -EINVAL;
+
scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock) {
- if ((reg_offset >= 0) && cti_is_active(config)) {
+ if (cti_is_active(config)) {
val = cti_read_single_reg(drvdata, reg_offset);
if (pcached_val)
*pcached_val = val;
if (kstrtoul(buf, 0, &val))
return -EINVAL;
+ if (reg_offset < 0)
+ return -EINVAL;
+
scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock) {
/* local store */
if (pcached_val)
*pcached_val = (u32)val;
/* write through if offset and enabled */
- if ((reg_offset >= 0) && cti_is_active(config))
+ if (cti_is_active(config))
cti_write_single_reg(drvdata, reg_offset, val);
}