Commit a72016a4 authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: sdhci-pci: Allow for 3 bytes from Intel DSM

The DSM used by some Intel controllers can return a 3 byte package. Allow
for that by using memcpy to copy the bytes.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 3fcc7834
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* - JMicron (hardware and technical support) * - JMicron (hardware and technical support)
*/ */
#include <linux/string.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -413,6 +414,7 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev, ...@@ -413,6 +414,7 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
{ {
union acpi_object *obj; union acpi_object *obj;
int err = 0; int err = 0;
size_t len;
obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), intel_dsm_uuid, 0, fn, NULL); obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), intel_dsm_uuid, 0, fn, NULL);
if (!obj) if (!obj)
...@@ -423,12 +425,10 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev, ...@@ -423,12 +425,10 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
goto out; goto out;
} }
if (obj->buffer.length >= 4) len = min_t(size_t, obj->buffer.length, 4);
*result = *(u32 *)obj->buffer.pointer;
else if (obj->buffer.length >= 2) *result = 0;
*result = *(u16 *)obj->buffer.pointer; memcpy(result, obj->buffer.pointer, len);
else
*result = *(u8 *)obj->buffer.pointer;
out: out:
ACPI_FREE(obj); ACPI_FREE(obj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment