Skip to content

Commit e59bf42

Browse files
committed
Merge tag 'spi-fix-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small set of fixes here. One core fix for error handling when we fail to set up the hardware before initiating a transfer and another one reverting a change in the core which broke Raspberry Pi in common use cases as part of some optimization work. There's also a couple of driver specific fixes" * tag 'spi-fix-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: abort spi_sync if failed to prepare_transfer_hardware spi: spi-fsl-spi: call spi_finalize_current_message() at the end spi: bitbang: Fix NULL pointer dereference in spi_unregister_master spi: Fix Raspberry Pi breakage
2 parents d1fdb6d + f3440d9 commit e59bf42

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

drivers/spi/spi-bitbang.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
406406
if (ret)
407407
spi_master_put(master);
408408

409-
return 0;
409+
return ret;
410410
}
411411
EXPORT_SYMBOL_GPL(spi_bitbang_start);
412412

drivers/spi/spi-fsl-spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ static int fsl_spi_do_one_msg(struct spi_master *master,
428428
}
429429

430430
m->status = status;
431-
spi_finalize_current_message(master);
432431

433432
if (status || !cs_change) {
434433
ndelay(nsecs);
435434
fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE);
436435
}
437436

438437
fsl_spi_setup_transfer(spi, NULL);
438+
spi_finalize_current_message(master);
439439
return 0;
440440
}
441441

drivers/spi/spi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,10 +1181,10 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,
11811181
if (msg->status && ctlr->handle_err)
11821182
ctlr->handle_err(ctlr, msg);
11831183

1184-
spi_finalize_current_message(ctlr);
1185-
11861184
spi_res_release(ctlr, msg);
11871185

1186+
spi_finalize_current_message(ctlr);
1187+
11881188
return ret;
11891189
}
11901190

@@ -1307,10 +1307,15 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
13071307
ret = ctlr->prepare_transfer_hardware(ctlr);
13081308
if (ret) {
13091309
dev_err(&ctlr->dev,
1310-
"failed to prepare transfer hardware\n");
1310+
"failed to prepare transfer hardware: %d\n",
1311+
ret);
13111312

13121313
if (ctlr->auto_runtime_pm)
13131314
pm_runtime_put(ctlr->dev.parent);
1315+
1316+
ctlr->cur_msg->status = ret;
1317+
spi_finalize_current_message(ctlr);
1318+
13141319
mutex_unlock(&ctlr->io_mutex);
13151320
return;
13161321
}

0 commit comments

Comments
 (0)