Re: [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume

From: Andy Shevchenko

Date: Tue Mar 10 2026 - 07:27:00 EST


On Mon, Mar 09, 2026 at 06:00:01PM -0400, Pratap Nirujogi wrote:
> Add NULL check for i_dev->map before calling i2c_dw_init() in the
> runtime resume path. The regmap may not be initialized yet when
> runtime PM tries to resume the device early in the probe sequence,
> leading to a NULL pointer dereference. Skip the i2c_dw_init() call
> if regmap is not yet created.
>
> This race condition occurs when runtime PM resume is triggered before
> i2c_dw_probe() completes the regmap initialization and was observed in
> kernel v7.0 where the order of device enumeration has changed because
> of the changes in registering the device sources in the device hierarchy.

> Co-developed-by: Bin Du <Bin.Du@xxxxxxx>

Please, read Submitting Patches on the tags, especially how to correctly use
Co-developed-by.

> Fixes: 02c057ddefef ("ACPI: video: Convert the driver to a platform one")
> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@xxxxxxx>

...

> i2c_dw_prepare_clk(i_dev, true);
> - i2c_dw_init(i_dev);
> +
> + /* Skip i2c_dw_init if regmap not yet created by i2c_dw_probe */

Use same style for references to the functions: func().

> + if (i_dev->map)
> + i2c_dw_init(i_dev);

TBH, Looks like papering over the problem. Why the resume is called on
uninitialised regmap to begin with?

--
With Best Regards,
Andy Shevchenko