@@ -1317,6 +1317,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
trace_spi_message_start(ctlr->cur_msg);
if (ctlr->prepare_message) {
+ struct list_head *tail = ctlr->cur_msg->resources.prev;
ret = ctlr->prepare_message(ctlr, ctlr->cur_msg);
if (ret) {
dev_err(&ctlr->dev, "failed to prepare message: %d\n",
@@ -1325,6 +1326,11 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
spi_finalize_current_message(ctlr);
goto out;
}
+ /* warn about possible issues on finalize */
+ if (ctlr->unprepare_message &&
+ tail != ctlr->cur_msg->resources.prev)
+ dev_warn_once(&ctlr->dev,
+ "spi_message.resource is modified and unprepare_message is defined - this can give unexpected results during finalize\n");
ctlr->cur_msg_prepared = true;
}