Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd8d984f authored by Wei Yongjun's avatar Wei Yongjun Committed by Mark Brown
Browse files

spi-topcliff-pch: fix to use list_for_each_entry_safe() when delete list items



Since we will remove items off the list using list_del_init() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarMark Brown <broonie@sirena.org.uk>
parent 0113f22e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -615,7 +615,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
	int size;
	u32 n_writes;
	int j;
	struct spi_message *pmsg;
	struct spi_message *pmsg, *tmp;
	const u8 *tx_buf;
	const u16 *tx_sbuf;

@@ -656,7 +656,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
	if (!data->pkt_rx_buff) {
		/* flush queue and set status of all transfers to -ENOMEM */
		dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__);
		list_for_each_entry(pmsg, data->queue.next, queue) {
		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
			pmsg->status = -ENOMEM;

			if (pmsg->complete != 0)
@@ -703,7 +703,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)

static void pch_spi_nomore_transfer(struct pch_spi_data *data)
{
	struct spi_message *pmsg;
	struct spi_message *pmsg, *tmp;
	dev_dbg(&data->master->dev, "%s called\n", __func__);
	/* Invoke complete callback
	 * [To the spi core..indicating end of transfer] */
@@ -740,7 +740,7 @@ static void pch_spi_nomore_transfer(struct pch_spi_data *data)
		dev_dbg(&data->master->dev,
			"%s suspend/remove initiated, flushing queue\n",
			__func__);
		list_for_each_entry(pmsg, data->queue.next, queue) {
		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
			pmsg->status = -EIO;

			if (pmsg->complete)
@@ -1187,7 +1187,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)

static void pch_spi_process_messages(struct work_struct *pwork)
{
	struct spi_message *pmsg;
	struct spi_message *pmsg, *tmp;
	struct pch_spi_data *data;
	int bpw;

@@ -1199,7 +1199,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
	if (data->board_dat->suspend_sts || (data->status == STATUS_EXITING)) {
		dev_dbg(&data->master->dev, "%s suspend/remove initiated,"
			"flushing queue\n", __func__);
		list_for_each_entry(pmsg, data->queue.next, queue) {
		list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
			pmsg->status = -EIO;

			if (pmsg->complete != 0) {