* [PATCH] staging: nvec: nvec_power: use GFP_KERNEL in probe()
@ 2026-07-10 15:01 Igor Putko
2026-07-12 15:41 ` Marc Dietrich
0 siblings, 1 reply; 2+ messages in thread
From: Igor Putko @ 2026-07-10 15:01 UTC (permalink / raw)
To: Marc Dietrich, Greg Kroah-Hartman
Cc: ac100, linux-tegra, linux-staging, linux-kernel, Igor Putko
nvec_power_probe() calls devm_kzalloc() with GFP_NOWAIT, which
disables direct reclaim and is meant for atomic context. probe()
runs in normal process context and may sleep, so this needlessly
risks a spurious -ENOMEM under memory pressure instead of just
waiting for reclaim like every other probe() allocation does.
nvec.c's own tegra_nvec_probe() already uses GFP_KERNEL for the
identical pattern, confirming this is an oversight, not intentional.
Signed-off-by: Igor Putko <igorpetindev@gmail.com>
---
drivers/staging/nvec/nvec_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
index 2faab9fde..c514d51a9 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -377,7 +377,7 @@ static int nvec_power_probe(struct platform_device *pdev)
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
struct power_supply_config psy_cfg = {};
- power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT);
+ power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_KERNEL);
if (!power)
return -ENOMEM;
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: nvec: nvec_power: use GFP_KERNEL in probe()
2026-07-10 15:01 [PATCH] staging: nvec: nvec_power: use GFP_KERNEL in probe() Igor Putko
@ 2026-07-12 15:41 ` Marc Dietrich
0 siblings, 0 replies; 2+ messages in thread
From: Marc Dietrich @ 2026-07-12 15:41 UTC (permalink / raw)
To: Igor Putko
Cc: Greg Kroah-Hartman, ac100, linux-tegra, linux-staging,
linux-kernel
Hello Igore,
On Fri, 10 Jul 2026, Igor Putko wrote:
> nvec_power_probe() calls devm_kzalloc() with GFP_NOWAIT, which
> disables direct reclaim and is meant for atomic context. probe()
> runs in normal process context and may sleep, so this needlessly
> risks a spurious -ENOMEM under memory pressure instead of just
> waiting for reclaim like every other probe() allocation does.
>
> nvec.c's own tegra_nvec_probe() already uses GFP_KERNEL for the
> identical pattern, confirming this is an oversight, not intentional.
I also see not reason to use GFP_NOWAIT here, even if it is unlikely to
cause problems in this code path, as it is used during bootup where there
should be "plenty" of RAM available. But I think it is a cleaner solution
to do memory allocations. So
Acked-by: Marc Dietrich <marvin24@gmx.de>
> Signed-off-by: Igor Putko <igorpetindev@gmail.com>
> ---
> drivers/staging/nvec/nvec_power.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
> index 2faab9fde..c514d51a9 100644
> --- a/drivers/staging/nvec/nvec_power.c
> +++ b/drivers/staging/nvec/nvec_power.c
> @@ -377,7 +377,7 @@ static int nvec_power_probe(struct platform_device *pdev)
> struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
> struct power_supply_config psy_cfg = {};
>
> - power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_NOWAIT);
> + power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_KERNEL);
> if (!power)
> return -ENOMEM;
>
> --
> 2.47.3
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-12 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 15:01 [PATCH] staging: nvec: nvec_power: use GFP_KERNEL in probe() Igor Putko
2026-07-12 15:41 ` Marc Dietrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox