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 <[email protected]> Reviewed-by: David E. Box <[email protected]> Signed-off-by: Michael J. Ruhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 4f8fa22 commit 147c18d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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)