Re: [PATCH] platform: chrome: Allocate sensorhub resource before claiming sensors

From: Doug Anderson
Date: Tue Apr 28 2020 - 19:03:00 EST


Hi,

On Mon, Apr 27, 2020 at 3:59 PM Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote:
>
> Allocate callbacks array before enumerating the sensors:
> The probe routine for these sensors (for instance cros_ec_sensors_probe)
> can be called within the sensorhub probe routine
> (cros_ec_sensors_probe())
>
> Fixes: 145d59baff594 ("platform/chrome: cros_ec_sensorhub: Add FIFO support")
>
> Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
> ---
> drivers/platform/chrome/cros_ec_sensorhub.c | 80 +++++++++++--------
> .../platform/chrome/cros_ec_sensorhub_ring.c | 73 ++++++++++-------
> .../linux/platform_data/cros_ec_sensorhub.h | 1 +
> 3 files changed, 93 insertions(+), 61 deletions(-)

I haven't done any review of this patch, but before this patch on my
hardware enabling 'CONFIG_IIO_CROS_EC_SENSORS_CORE=y' would cause a
NULL pointer dereference at boot. After picking this patch the NULL
pointer dereference is gone. The details were in
<https://crbug.com/1074471>. I haven't done any other testing than
that, though. ;-) If it's useful:

Reported-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
Tested-by: Douglas Anderson <dianders@xxxxxxxxxxxx>

-Doug