Skip to content

Commit 147c18d

Browse files
mjruhlij-intel
authored andcommitted
platform/x86/intel/pmt: re-order trigger logic
Setting the clear bit or checking the complete bit before checking to see if crashlog is disabled seems incorrect. Check disable before accessing any other bits. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Link: https://lore.kernel.org/r/20250713172943.7335-8-michael.j.ruhl@intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 4f8fa22 commit 147c18d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/platform/x86/intel/pmt/crashlog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ trigger_store(struct device *dev, struct device_attribute *attr,
193193

194194
guard(mutex)(&entry->control_mutex);
195195

196+
/* if device is currently disabled, return busy */
197+
if (pmt_crashlog_disabled(&entry->entry))
198+
return -EBUSY;
199+
196200
if (!trigger) {
197201
pmt_crashlog_set_clear(&entry->entry);
198202
return count;
@@ -202,10 +206,6 @@ trigger_store(struct device *dev, struct device_attribute *attr,
202206
if (pmt_crashlog_complete(&entry->entry))
203207
return -EEXIST;
204208

205-
/* if device is currently disabled, return busy */
206-
if (pmt_crashlog_disabled(&entry->entry))
207-
return -EBUSY;
208-
209209
pmt_crashlog_set_execute(&entry->entry);
210210

211211
return count;

0 commit comments

Comments
 (0)