Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

Jonathan Neuschäfer
2021-11-10T10:46:13Z

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

On Mon, Nov 08, 2021 at 02:36:42PM +0300, Dmitry Osipenko wrote:
> 08.11.2021 14:22, Jonathan Neuschäfer пишет:
> > On Sun, Nov 07, 2021 at 08:42:33PM +0300, Dmitry Osipenko wrote:
> > [...]
> >> EC drivers tend to use higher priority in general. Jonathan, could you
> >> please confirm that NTXEC driver is a more preferable restart method
> >> than the watchdog?
> >
> > Yes. The original firmware uses the NTXEC to restart, and it works well,
> > so I do think it's preferable.
>
> Thank you, then I'll update the NTXEC patch like this:
>
> https://github.com/grate-driver/linux/commit/22da3d91f1734d9a0ed036220ad4ea28465af988

I tested again, but sys_off_handler_reboot called a bogus pointer
(probably reboot_prepare_cb). I think it was left uninitialized in
ntxec_probe, which uses devm_kmalloc. I guess we could switch it to
devm_kzalloc:

diff --git a/drivers/mfd/ntxec.c b/drivers/mfd/ntxec.c
index 1f55dfce14308..30364beb4b1d0 100644
--- a/drivers/mfd/ntxec.c
+++ b/drivers/mfd/ntxec.c
@@ -144,7 +144,7 @@ static int ntxec_probe(struct i2c_client *client)
const struct mfd_cell *subdevs;
size_t n_subdevs;

- ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL);
+ ec = devm_kzalloc(&client->dev, sizeof(*ec), GFP_KERNEL);
if (!ec)
return -ENOMEM;

With that done, it works flawlessly.

Thanks,
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]