X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH 1/4] platform/x86: int3472: Check for adev == NULL
@ 2024-11-28 15:42 Hans de Goede
  2024-11-28 15:42 ` [PATCH 2/4] platform/x86: int3472: Drop "pin number mismatch" messages Hans de Goede
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Hans de Goede @ 2024-11-28 15:42 UTC (permalink / raw)
  To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

Not all devices have an ACPI companion fwnode, so adev might be NULL. This
can e.g. (theoretically) happen when a user manually binds one of
the int3472 drivers to another i2c/platform device through sysfs.

Add a check for adev not being set and return -ENODEV in that case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/intel/int3472/discrete.c | 3 +++
 drivers/platform/x86/intel/int3472/tps68470.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index 3de463c3d13b..15678508ee50 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -336,6 +336,9 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev)
 	struct int3472_cldb cldb;
 	int ret;
 
+	if (!adev)
+		return -ENODEV;
+
 	ret = skl_int3472_fill_cldb(adev, &cldb);
 	if (ret) {
 		dev_err(&pdev->dev, "Couldn't fill CLDB structure\n");
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 1e107fd49f82..81ac4c691963 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -152,6 +152,9 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client)
 	int ret;
 	int i;
 
+	if (!adev)
+		return -ENODEV;
+
 	n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata);
 	if (n_consumers < 0)
 		return n_consumers;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-12-04 19:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 15:42 [PATCH 1/4] platform/x86: int3472: Check for adev == NULL Hans de Goede
2024-11-28 15:42 ` [PATCH 2/4] platform/x86: int3472: Drop "pin number mismatch" messages Hans de Goede
2024-11-28 15:52   ` Andy Shevchenko
2024-12-04 17:36     ` Hans de Goede
2024-12-04 18:23       ` Andy Shevchenko
2024-11-28 15:42 ` [PATCH 3/4] platform/x86: int3472: Fix skl_int3472_handle_gpio_resources() return value Hans de Goede
2024-11-28 15:53   ` Andy Shevchenko
2024-12-04 17:37     ` Hans de Goede
2024-11-28 15:42 ` [PATCH 4/4] platform/x86: int3472: Debug log the sensor name Hans de Goede
2024-11-28 15:51 ` [PATCH 1/4] platform/x86: int3472: Check for adev == NULL Andy Shevchenko
2024-12-04 17:40   ` Hans de Goede
2024-12-04 19:15     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox