Skip to contentSkip to conversation

spi: propagate error code to the caller of acpi_spi_device_alloc()

PATCH In review Andy Shevchenko 2 participants 3 messages Jul 9, 2022 – Jul 11, 2022 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 spi: propagate error code to the caller of acpi_spi_device_alloc()

Since acpi_spi_device_alloc() has been designed to return an error pointer we may now properly propagate error codes to the caller of it. It helps debugging a lot.

---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi.c +1 -1
index 0690f018c413..d4a8665410ea 100644
@@ -2565,7 +2565,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
 
 	if (ret < 0)
 		/* Found SPI in _CRS but it points to another controller */
-		return ERR_PTR(-ENODEV);
+		return ERR_PTR(ret);
 
 	if (!lookup.max_speed_hz &&
 	    ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) &&
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 spi: remove duplicate parameters check in acpi_spi_add_resource()

The acpi_spi_add_resource() is never called with ctrl == NULL and index == -1. The only caller already performs the check. Hence remove the duplication from the acpi_spi_add_resource().

---
 drivers/spi/spi.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/spi/spi.c +0 -3
index d4a8665410ea..9b080dafa52c 100644
@@ -2459,9 +2459,6 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
 			if (lookup->index != -1 && lookup->n++ != lookup->index)
 				return 1;
 
-			if (lookup->index == -1 && !ctlr)
-				return -ENODEV;
-
 			status = acpi_get_handle(NULL,
 						 sb->resource_source.string_ptr,
 						 &parent_handle);
Signature · 1 line
2.35.1
maintainer
#2 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko

Since acpi_spi_device_alloc() has been designed to return an error pointer we may now properly propagate error codes to the caller of it. It helps debugging a lot.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: propagate error code to the caller of acpi_spi_device_alloc()

      commit: b6747f4fba399a73a87fac80ac1d0c952a44b222
[2/2] spi: remove duplicate parameters check in acpi_spi_add_resource()
      commit: cdb0cc9379f1b4fa5ea3e0492bacf8008f3f4e5a

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark