Re: [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume
From: Nirujogi, Pratap
Date: Thu Mar 19 2026 - 17:24:37 EST
Hi Andy,
On 3/10/2026 7:21 AM, Andy Shevchenko wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.sure, will fix the incorrect usage of tags in the next version.
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.
sure, will fix it in the next version.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().
yes, I agree, this change avoids the issue rather than fixing the root cause of the race condition. I investigated further and shared the details in response to Mario’s comments. Could you please review the latest response[1] and share your feedback?+ 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?
[1] https://lore.kernel.org/all/61dbe8a1-6578-4690-8571-6b00c1850d34@xxxxxxx/
Thanks,
Pratap
--
With Best Regards,
Andy Shevchenko