[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <GCM08Q.D2GF67F5O2R03@crapouillou.net>
Date: Mon, 30 Mar 2020 18:41:04 +0200
From: Paul Cercueil <paul@...pouillou.net>
To: Thierry Reding <thierry.reding@...il.com>
Cc: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>, od@...c.me,
linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
Mathieu Malaterre <malat@...ian.org>,
Artur Rojek <contact@...ur-rojek.eu>
Subject: Re: [PATCH v4 3/4] pwm: jz4740: Obtain regmap from parent node
Hi Thierry,
Le lun. 30 mars 2020 à 16:37, Thierry Reding
<thierry.reding@...il.com> a écrit :
> 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.
Yes, that works for me. Good catch.
Thanks,
-Paul
>
> Thierry
Powered by blists - more mailing lists