Michal Kazior <michal.kazior@xxxxxxxxx> writes: > This can be useful for testing. To perform a > forced firmware crash write 'crash' to > 'simulate_fw_crash' debugfs file. E.g. > > echo crash > /sys/kernel/debug/ieee80211/phy1/ath10k/simulate_fw_crash > > Signed-off-by: Michal Kazior <michal.kazior@xxxxxxxxx> [...] > +static ssize_t ath10k_write_simulate_fw_crash(struct file *file, > + const char __user *user_buf, > + size_t count, loff_t *ppos) > +{ > + struct ath10k *ar = file->private_data; > + char buf[32] = {}; > + int ret; > + > + mutex_lock(&ar->conf_mutex); > + > + simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); > + if (strcmp(buf, "crash") && strcmp(buf, "crash\n")) { > + ath10k_warn("write keyword `crash` to simulate firmware crash\n"); > + goto exit; > + } Better to just return an error here. > + if (ar->state != ATH10K_STATE_ON && > + ar->state != ATH10K_STATE_RESTARTED) { > + ath10k_warn("firmware isn't loaded yet, nothing to crash\n"); > + goto exit; > + } Ditto. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html