* [PATCH] mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set"
@ 2026-08-23 10:18 David Heidelberg via B4 Relay
2026-09-03 12:49 ` Lee Jones
0 siblings, 1 reply; 3+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-08-23 10:18 UTC (permalink / raw)
To: Lee Jones, Thomas Tai, Konrad Rzeszutek Wilk
Cc: mfd, linux-kernel, phone-devel, stable, David Heidelberg
From: David Heidelberg <david@ixit.cz>
The wcd934x MFD parent (a slim_device) never initializes its
dma_mask/coherent_dma_mask. When the DT-aware children pass through
of_dma_configure() this triggers the "DMA mask not set" warning for
each child.
Cc: stable@vger.kernel.org
Fixes: f959dcd6ddfd ("dma-direct: Fix potential NULL pointer dereference")
Assisted-by: tencent:hy3
Signed-off-by: David Heidelberg <david@ixit.cz>
---
drivers/mfd/wcd934x.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
index 3c3080e8c8cf7..70ee13791d52b 100644
--- a/drivers/mfd/wcd934x.c
+++ b/drivers/mfd/wcd934x.c
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019, Linaro Limited
#include <linux/clk.h>
+#include <linux/dma-mapping.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/mfd/wcd934x/registers.h>
#include <linux/mfd/wcd934x/wcd934x.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -212,16 +213,21 @@ static int wcd934x_slim_status(struct slim_device *sdev,
static int wcd934x_slim_probe(struct slim_device *sdev)
{
struct device *dev = &sdev->dev;
struct device_node *np = dev->of_node;
struct wcd934x_ddata *ddata;
struct gpio_desc *reset_gpio;
int ret;
+ if (!dev->dma_mask) {
+ dev->dma_mask = &dev->coherent_dma_mask;
+ dev->coherent_dma_mask = DMA_BIT_MASK(32);
+ }
+
ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata)
return -ENOMEM;
ddata->irq = of_irq_get(np, 0);
if (ddata->irq < 0)
return dev_err_probe(ddata->dev, ddata->irq,
"Failed to get IRQ\n");
---
base-commit: 7079a12d7506b07fb53b54a664bfad5fa9b16d70
change-id: 20260823-wcd-dma-bd621ee39887
Best regards,
--
David Heidelberg <david@ixit.cz>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set"
2026-08-23 10:18 [PATCH] mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set" David Heidelberg via B4 Relay
@ 2026-09-03 12:49 ` Lee Jones
2026-09-03 14:40 ` David Heidelberg
0 siblings, 1 reply; 3+ messages in thread
From: Lee Jones @ 2026-09-03 12:49 UTC (permalink / raw)
To: david
Cc: Thomas Tai, Konrad Rzeszutek Wilk, mfd, linux-kernel,
phone-devel, stable
On Sun, 23 Aug 2026, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@ixit.cz>
>
> The wcd934x MFD parent (a slim_device) never initializes its
> dma_mask/coherent_dma_mask. When the DT-aware children pass through
> of_dma_configure() this triggers the "DMA mask not set" warning for
> each child.
>
> Cc: stable@vger.kernel.org
> Fixes: f959dcd6ddfd ("dma-direct: Fix potential NULL pointer dereference")
> Assisted-by: tencent:hy3
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
> drivers/mfd/wcd934x.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
> index 3c3080e8c8cf7..70ee13791d52b 100644
> --- a/drivers/mfd/wcd934x.c
> +++ b/drivers/mfd/wcd934x.c
> @@ -1,12 +1,13 @@
> // SPDX-License-Identifier: GPL-2.0
> // Copyright (c) 2019, Linaro Limited
>
> #include <linux/clk.h>
> +#include <linux/dma-mapping.h>
> #include <linux/gpio/consumer.h>
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/mfd/core.h>
> #include <linux/mfd/wcd934x/registers.h>
> #include <linux/mfd/wcd934x/wcd934x.h>
> #include <linux/module.h>
> #include <linux/of.h>
> @@ -212,16 +213,21 @@ static int wcd934x_slim_status(struct slim_device *sdev,
> static int wcd934x_slim_probe(struct slim_device *sdev)
> {
> struct device *dev = &sdev->dev;
> struct device_node *np = dev->of_node;
> struct wcd934x_ddata *ddata;
> struct gpio_desc *reset_gpio;
> int ret;
>
> + if (!dev->dma_mask) {
> + dev->dma_mask = &dev->coherent_dma_mask;
> + dev->coherent_dma_mask = DMA_BIT_MASK(32);
> + }
> +
Any reason not to use dma_coerce_mask_and_coherent()?
> ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
> if (!ddata)
> return -ENOMEM;
>
> ddata->irq = of_irq_get(np, 0);
> if (ddata->irq < 0)
> return dev_err_probe(ddata->dev, ddata->irq,
> "Failed to get IRQ\n");
>
> ---
> base-commit: 7079a12d7506b07fb53b54a664bfad5fa9b16d70
> change-id: 20260823-wcd-dma-bd621ee39887
>
> Best regards,
> --
> David Heidelberg <david@ixit.cz>
>
>
--
Lee Jones
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set"
2026-09-03 12:49 ` Lee Jones
@ 2026-09-03 14:40 ` David Heidelberg
0 siblings, 0 replies; 3+ messages in thread
From: David Heidelberg @ 2026-09-03 14:40 UTC (permalink / raw)
To: Lee Jones
Cc: Thomas Tai, Konrad Rzeszutek Wilk, mfd, linux-kernel,
phone-devel, stable
On 03/09/2026 14:49, Lee Jones wrote:
> On Sun, 23 Aug 2026, David Heidelberg via B4 Relay wrote:
>
>> From: David Heidelberg <david@ixit.cz>
>>
>> The wcd934x MFD parent (a slim_device) never initializes its
>> dma_mask/coherent_dma_mask. When the DT-aware children pass through
>> of_dma_configure() this triggers the "DMA mask not set" warning for
>> each child.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: f959dcd6ddfd ("dma-direct: Fix potential NULL pointer dereference")
>> Assisted-by: tencent:hy3
>> Signed-off-by: David Heidelberg <david@ixit.cz>
>> ---
>> drivers/mfd/wcd934x.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
>> index 3c3080e8c8cf7..70ee13791d52b 100644
>> --- a/drivers/mfd/wcd934x.c
>> +++ b/drivers/mfd/wcd934x.c
>> @@ -1,12 +1,13 @@
>> // SPDX-License-Identifier: GPL-2.0
>> // Copyright (c) 2019, Linaro Limited
>>
>> #include <linux/clk.h>
>> +#include <linux/dma-mapping.h>
>> #include <linux/gpio/consumer.h>
>> #include <linux/interrupt.h>
>> #include <linux/kernel.h>
>> #include <linux/mfd/core.h>
>> #include <linux/mfd/wcd934x/registers.h>
>> #include <linux/mfd/wcd934x/wcd934x.h>
>> #include <linux/module.h>
>> #include <linux/of.h>
>> @@ -212,16 +213,21 @@ static int wcd934x_slim_status(struct slim_device *sdev,
>> static int wcd934x_slim_probe(struct slim_device *sdev)
>> {
>> struct device *dev = &sdev->dev;
>> struct device_node *np = dev->of_node;
>> struct wcd934x_ddata *ddata;
>> struct gpio_desc *reset_gpio;
>> int ret;
>>
>> + if (!dev->dma_mask) {
>> + dev->dma_mask = &dev->coherent_dma_mask;
>> + dev->coherent_dma_mask = DMA_BIT_MASK(32);
>> + }
>> +
>
> Any reason not to use dma_coerce_mask_and_coherent()?
Didn't knew about it. Sending v2.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-03 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-23 10:18 [PATCH] mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set" David Heidelberg via B4 Relay
2026-09-03 12:49 ` Lee Jones
2026-09-03 14:40 ` David Heidelberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®