Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1293920

Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

From Neil Armstrong <narmstrong@baylibre.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers
Date 2015-12-17 15:10 +0100
Message-ID <qGHpO-py-21@gated-at.bofh.it> (permalink)
References <qqljA-4Eg-11@gated-at.bofh.it> <qGn7I-46S-15@gated-at.bofh.it>
Organization Baylibre

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Thierry,
On 12/16/2015 05:27 PM, Thierry Reding wrote:
> I've applied this with some coding style bikeshedding applied. Also I
> think there's a timer leak in the probe function:
Indeed, the coding style had some root for ameliorations ! Thanks !
I also missed this timer leak, thanks for the fix.
>
>> diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
> [...]
>> +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
>> +{
> [...]
>> +	dm_timer = pdata->request_by_node(timer);
>> +	if (!dm_timer)
>> +		return -EPROBE_DEFER;
>
> dm_timer holds the requested timer now.
>
>> +
>> +	omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
>> +	if (!omap)
>> +		return -ENOMEM;
>
> But it's not released when this allocation fails...
>
>> +
>> +	omap->pdata = pdata;
>> +	omap->dm_timer = dm_timer;
>> +	omap->dm_timer_pdev = of_find_device_by_node(timer);
>> +	if (!omap->dm_timer_pdev) {
>> +		dev_err(&pdev->dev, "Unable to find timer pdev\n");
>> +		return -EINVAL;
>> +	}
>
> ... nor when this lookup fails. I've taken the liberty of adding two
> calls to omap->pdata->free(dm_timer) to these error paths.
Perfect !

> Please take a look at what's in the pwm/for-next branch to see if it
> still works correctly.
I had a look against my original patch and it should be ok, I will still hook it up back
on the real HW in case we forgot something.

> Thanks,
> Thierry
>

Thanks !
Neil


Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers Thierry Reding <thierry.reding@gmail.com> - 2015-12-16 17:30 +0100
  Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers Neil Armstrong <narmstrong@baylibre.com> - 2015-12-17 15:10 +0100

csiph-web