From patchwork Wed Dec 23 09:04:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 69479 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBN94Kvj025942 for ; Wed, 23 Dec 2009 09:04:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbZLWJES (ORCPT ); Wed, 23 Dec 2009 04:04:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754116AbZLWJES (ORCPT ); Wed, 23 Dec 2009 04:04:18 -0500 Received: from mga02.intel.com ([134.134.136.20]:18580 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754087AbZLWJEP (ORCPT ); Wed, 23 Dec 2009 04:04:15 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 23 Dec 2009 01:02:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,441,1257148800"; d="scan'208";a="581528058" Received: from sli10-conroe.sh.intel.com (HELO sli10-desk.sh.intel.com) ([10.239.13.36]) by orsmga001.jf.intel.com with ESMTP; 23 Dec 2009 01:03:50 -0800 Received: from david by sli10-desk.sh.intel.com with local (Exim 4.69) (envelope-from ) id 1NNN8d-0002Vq-LV; Wed, 23 Dec 2009 17:04:11 +0800 Date: Wed, 23 Dec 2009 17:04:11 +0800 From: Shaohua Li To: Yinghai Lu Cc: Ingo Molnar , Len Brown , "Barnes, Jesse" , Linus Torvalds , Andrew Morton , "linux-acpi@vger.kernel.org" , Linux Kernel Mailing List , "linux-pci@vger.kernel.org" Subject: Re: [git pull request] ACPI and driver patches for 2.6.33.merge Message-ID: <20091223090411.GA8526@sli10-desk.sh.intel.com> References: <86802c440912171728s27dd7108k85a0f1563660c95b@mail.gmail.com> <20091218022112.GA30333@sli10-desk.sh.intel.com> <20091218051457.GB417@elte.hu> <4B309AB9.7030208@kernel.org> <20091223005637.GA16783@sli10-desk.sh.intel.com> <4B317491.5050303@kernel.org> <86802c440912221809w35dbb1eegcf6133ed1f190069@mail.gmail.com> <20091223024513.GA30764@sli10-desk.sh.intel.com> <4B31870F.7090106@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B31870F.7090106@kernel.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 65f7e33..0c1ad31 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -397,6 +397,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) union acpi_object *out_obj; u8 uuid[16]; u32 errors; + struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; if (!context) return AE_ERROR; @@ -419,16 +420,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) in_params[3].buffer.length = context->cap.length; in_params[3].buffer.pointer = context->cap.pointer; - status = acpi_evaluate_object(handle, "_OSC", &input, &context->ret); + status = acpi_evaluate_object(handle, "_OSC", &input, &output); if (ACPI_FAILURE(status)) return status; - /* return buffer should have the same length as cap buffer */ - if (context->ret.length != context->cap.length) + if (!output.length) return AE_NULL_OBJECT; - out_obj = context->ret.pointer; - if (out_obj->type != ACPI_TYPE_BUFFER) { + out_obj = output.pointer; + if (out_obj->type != ACPI_TYPE_BUFFER + || out_obj->buffer.length != context->cap.length) { acpi_print_osc_error(handle, context, "_OSC evaluation returned wrong type"); status = AE_TYPE; @@ -457,11 +458,20 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) goto out_kfree; } out_success: - return AE_OK; + context->ret.length = out_obj->buffer.length; + context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL); + if (!context->ret.pointer) { + status = AE_NO_MEMORY; + goto out_kfree; + } + memcpy(context->ret.pointer, out_obj->buffer.pointer, + context->ret.length); + status = AE_OK; out_kfree: - kfree(context->ret.pointer); - context->ret.pointer = NULL; + kfree(output.pointer); + if (status != AE_OK) + context->ret.pointer = NULL; return status; } EXPORT_SYMBOL(acpi_run_osc);