Unverified Commit 2765f16c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Ilpo Järvinen
Browse files

platform/x86: intel_sar: Check ACPI_HANDLE() against NULL



Every platform driver can be forced to match a device that doesn't match
its list of device IDs because of device_match_driver_override(), so
platform drivers that rely on the existence of a device's ACPI companion
object need to verify its presence.

Accordingly, add a requisite ACPI_HANDLE() check against NULL to the
platform/x86 intel_sar driver.

Fixes: dcfbd31e ("platform/x86: BIOS SAR driver for Intel M.2 Modem")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/14023870.uLZWGnKmhe@rafael.j.wysocki


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 5c69e090
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -245,15 +245,20 @@ static void sar_get_data(int reg, struct wwan_sar_context *context)
static int sar_probe(struct platform_device *device)
{
	struct wwan_sar_context *context;
	acpi_handle handle;
	int reg;
	int result;

	handle = ACPI_HANDLE(&device->dev);
	if (!handle)
		return -ENODEV;

	context = kzalloc_obj(*context);
	if (!context)
		return -ENOMEM;

	context->sar_device = device;
	context->handle = ACPI_HANDLE(&device->dev);
	context->handle = handle;
	dev_set_drvdata(&device->dev, context);

	result = guid_parse(SAR_DSM_UUID, &context->guid);