Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+10 -5
+1 -1
drivers/spi/spi-bitbang.c
··· 406 406 if (ret) 407 407 spi_master_put(master); 408 408 409 - return 0; 409 + return ret; 410 410 } 411 411 EXPORT_SYMBOL_GPL(spi_bitbang_start); 412 412
+1 -1
drivers/spi/spi-fsl-spi.c
··· 428 428 } 429 429 430 430 m->status = status; 431 - spi_finalize_current_message(master); 432 431 433 432 if (status || !cs_change) { 434 433 ndelay(nsecs); ··· 435 436 } 436 437 437 438 fsl_spi_setup_transfer(spi, NULL); 439 + spi_finalize_current_message(master); 438 440 return 0; 439 441 } 440 442
+8 -3
drivers/spi/spi.c
··· 1181 1181 if (msg->status && ctlr->handle_err) 1182 1182 ctlr->handle_err(ctlr, msg); 1183 1183 1184 - spi_finalize_current_message(ctlr); 1185 - 1186 1184 spi_res_release(ctlr, msg); 1185 + 1186 + spi_finalize_current_message(ctlr); 1187 1187 1188 1188 return ret; 1189 1189 } ··· 1307 1307 ret = ctlr->prepare_transfer_hardware(ctlr); 1308 1308 if (ret) { 1309 1309 dev_err(&ctlr->dev, 1310 - "failed to prepare transfer hardware\n"); 1310 + "failed to prepare transfer hardware: %d\n", 1311 + ret); 1311 1312 1312 1313 if (ctlr->auto_runtime_pm) 1313 1314 pm_runtime_put(ctlr->dev.parent); 1315 + 1316 + ctlr->cur_msg->status = ret; 1317 + spi_finalize_current_message(ctlr); 1318 + 1314 1319 mutex_unlock(&ctlr->io_mutex); 1315 1320 return; 1316 1321 }