lkml.org 
[lkml]   [2020]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 3/4] pwm: jz4740: Obtain regmap from parent node
On Mon, Mar 23, 2020 at 03:24:20PM +0100, Paul Cercueil wrote:
[...]
> diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
[...]
> @@ -196,12 +208,19 @@ static const struct pwm_ops jz4740_pwm_ops = {
> static int jz4740_pwm_probe(struct platform_device *pdev)
> {
> struct jz4740_pwm_chip *jz4740;
> + struct device *dev = &pdev->dev;
>
> - jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL);
> + jz4740 = devm_kzalloc(dev, sizeof(*jz4740), GFP_KERNEL);
> if (!jz4740)
> return -ENOMEM;
>
> - jz4740->chip.dev = &pdev->dev;
> + jz4740->map = device_node_to_regmap(dev->parent->of_node);
> + if (!jz4740->map) {

This seems wrong. According to the code, device_node_to_regmap() returns
an ERR_PTR()-encoded error code on failure, so I think this should be:

if (IS_ERR(jz4740->map)) {
...
return PTR_ERR(jz4740->map);
}

No need to resend for that, I can take care of that when applying. Let
me know if that doesn't work.

Thierry
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-03-30 16:37    [W:0.091 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site