Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b697b537 authored by Karol Kozimor's avatar Karol Kozimor Committed by Len Brown
Browse files

[ASUS_ACPI] work around Samsung P30s oops



The code used to rely on a certain method to return a NULL buffer, which
is now hardly possible with the implicit return code on by default. This
sort of fixes bugs #5067 and #5092 for now.

Note: this patch makes the driver unusable on said machines (and on said
machines only) iff acpi=strict is specified, but it seems noone really uses
that.

Signed-off-by: default avatarKarol Kozimor <sziwan@hell.org.pl>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3603bc8d
Loading
Loading
Loading
Loading
+18 −9
Original line number Diff line number Diff line
@@ -987,9 +987,21 @@ static int __init asus_hotk_get_info(void)
		printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n",
		       bsts_result);

	/* Samsung P30 has a device with a valid _HID whose INIT does not 
	 * return anything. Catch this one and any similar here */
	if (buffer.pointer == NULL) {
	/* This is unlikely with implicit return */
	if (buffer.pointer == NULL)
		return -EINVAL;

	model = (union acpi_object *) buffer.pointer;
	/*
	 * Samsung P30 has a device with a valid _HID whose INIT does not 
	 * return anything. It used to be possible to catch this exception,
	 * but the implicit return code will now happily confuse the 
	 * driver. We assume that every ACPI_TYPE_STRING is a valid model
	 * identifier but it's still possible to get completely bogus data.
	 */
	if (model->type == ACPI_TYPE_STRING) {
		printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
	} else {
		if (asus_info &&	/* Samsung P30 */
		    strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
			hotk->model = P30;
@@ -1002,13 +1014,10 @@ static int __init asus_hotk_get_info(void)
			       "the developers with your DSDT\n");
		}
		hotk->methods = &model_conf[hotk->model];
		return AE_OK;
	}
		
	model = (union acpi_object *)buffer.pointer;
	if (model->type == ACPI_TYPE_STRING) {
		printk(KERN_NOTICE "  %s model detected, ",
		       model->string.pointer);
		acpi_os_free(model);

		return AE_OK;
	}

	hotk->model = END_MODEL;