* [PATCH] pwm: omap-dmtimer: Add missing put_device() call in pwm_omap_dmtimer_probe() @ 2019-11-09 12:26 Markus Elfring 2019-11-11 7:19 ` Uwe Kleine-König 0 siblings, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-09 12:26 UTC (permalink / raw) To: linux-pwm, Claudiu Beznea, Keerthy, Neil Armstrong, Thierry Reding, Tony Lindgren, Uwe Kleine-König Cc: LKML, kernel-janitors, Grant Erickson, Joachim Eastwood, Neil Brown, Wen Yang From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 9 Nov 2019 13:09:42 +0100 A coccicheck run provided information like the following. drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; call of_find_device_by_node on line 255, but without a corresponding object release within this function. Generated by: scripts/coccinelle/free/put_device.cocci Thus add jump targets to fix the exception handling for this function implementation. Fixes: b7290cf6ff7869ec12070aa146c370728cab62c2 ("pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops") Fixes: 6604c6556db9e41c85f2839f66bd9d617bcf9f87 ("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/pwm/pwm-omap-dmtimer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 00772fc53490..958854213786 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -301,12 +301,13 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) put: of_node_put(timer); if (ret < 0) - return ret; + goto check_timer_pdev; omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); if (!omap) { pdata->free(dm_timer); - return -ENOMEM; + ret = -ENOMEM; + goto put_device; } omap->pdata = pdata; @@ -340,12 +341,19 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "failed to register PWM\n"); omap->pdata->free(omap->dm_timer); - return ret; + goto put_device; } platform_set_drvdata(pdev, omap); return 0; + +check_timer_pdev: + if (timer_pdev) +put_device: + put_device(&timer_pdev->dev); + + return ret; } static int pwm_omap_dmtimer_remove(struct platform_device *pdev) -- 2.24.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] pwm: omap-dmtimer: Add missing put_device() call in pwm_omap_dmtimer_probe() 2019-11-09 12:26 [PATCH] pwm: omap-dmtimer: Add missing put_device() call in pwm_omap_dmtimer_probe() Markus Elfring @ 2019-11-11 7:19 ` Uwe Kleine-König [not found] ` <20191111090357.13903-1-u.kleine-koenig@pengutronix.de> 0 siblings, 1 reply; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 7:19 UTC (permalink / raw) To: Markus Elfring Cc: linux-pwm, Claudiu Beznea, Keerthy, Neil Armstrong, Thierry Reding, Tony Lindgren, LKML, kernel-janitors, Grant Erickson, Joachim Eastwood, Neil Brown, Wen Yang Hello Markus, On Sat, Nov 09, 2019 at 01:26:50PM +0100, Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 9 Nov 2019 13:09:42 +0100 > > A coccicheck run provided information like the following. > > drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; > call of_find_device_by_node on line 255, but without a corresponding > object release within this function. > > Generated by: scripts/coccinelle/free/put_device.cocci > > Thus add jump targets to fix the exception handling for this > function implementation. > > Fixes: b7290cf6ff7869ec12070aa146c370728cab62c2 ("pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops") > Fixes: 6604c6556db9e41c85f2839f66bd9d617bcf9f87 ("pwm: Add PWM driver for OMAP using dual-mode timers") > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/pwm/pwm-omap-dmtimer.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c > index 00772fc53490..958854213786 100644 > --- a/drivers/pwm/pwm-omap-dmtimer.c > +++ b/drivers/pwm/pwm-omap-dmtimer.c > @@ -301,12 +301,13 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > put: > of_node_put(timer); > if (ret < 0) > - return ret; > + goto check_timer_pdev; > > omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); > if (!omap) { > pdata->free(dm_timer); > - return -ENOMEM; > + ret = -ENOMEM; > + goto put_device; > } > > omap->pdata = pdata; > @@ -340,12 +341,19 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > if (ret < 0) { > dev_err(&pdev->dev, "failed to register PWM\n"); > omap->pdata->free(omap->dm_timer); > - return ret; > + goto put_device; > } > > platform_set_drvdata(pdev, omap); > > return 0; > + > +check_timer_pdev: > + if (timer_pdev) > +put_device: > + put_device(&timer_pdev->dev); This is ugly but necessary with the driver as is because the error handling is interwinded within the normal path through this function. I would prefer to clean this up first, then this fix gets a bit nicer. Will send a patch in reply to this mail. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <20191111090357.13903-1-u.kleine-koenig@pengutronix.de>]
[parent not found: <20191111091606.qf7gj5gln3khfnsl@pengutronix.de>]
* Re: [0/4] pwm: omap-dmtimer: Software improvements [not found] ` <20191111091606.qf7gj5gln3khfnsl@pengutronix.de> @ 2019-11-11 13:28 ` Markus Elfring 2019-11-11 13:28 ` Markus Elfring 1 sibling, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:28 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, LKML, kernel-janitors > I created a cover letter but failed to send it together with the series > :-| Did you omit the address “linux-kernel@vger.kernel.org” from the recipient list intentionally? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [0/4] pwm: omap-dmtimer: Software improvements [not found] ` <20191111091606.qf7gj5gln3khfnsl@pengutronix.de> 2019-11-11 13:28 ` [0/4] pwm: omap-dmtimer: Software improvements Markus Elfring @ 2019-11-11 13:28 ` Markus Elfring 2019-11-11 19:57 ` Uwe Kleine-König 1 sibling, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:28 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, LKML, kernel-janitors > I created a cover letter but failed to send it together with the series > :-| Did you omit the address “linux-kernel@vger.kernel.org” from the recipient list intentionally? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [0/4] pwm: omap-dmtimer: Software improvements 2019-11-11 13:28 ` Markus Elfring @ 2019-11-11 19:57 ` Uwe Kleine-König 0 siblings, 0 replies; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 19:57 UTC (permalink / raw) To: Markus Elfring Cc: linux-pwm, Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel On Mon, Nov 11, 2019 at 02:28:52PM +0100, Markus Elfring wrote: > > I created a cover letter but failed to send it together with the series > > :-| > > Did you omit the address “linux-kernel@vger.kernel.org” from > the recipient list intentionally? Yes, even though it's documented to Cc: all patches there, there is IMHO little use. If there is a dedicated mailing list, not adding lkml is fine for all maintainers I interacted with in the last few years. The volume on lkml is that high that sending all patches there only adds noise. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional [not found] ` <20191111090357.13903-1-u.kleine-koenig@pengutronix.de> [not found] ` <20191111091606.qf7gj5gln3khfnsl@pengutronix.de> @ 2019-11-11 13:30 ` Markus Elfring 2019-11-11 20:00 ` Uwe Kleine-König [not found] ` <20191111090357.13903-2-u.kleine-koenig@pengutronix.de> ` (2 subsequent siblings) 4 siblings, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:30 UTC (permalink / raw) To: Uwe Kleine-König, Thierry Reding, linux-pwm Cc: Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML > In the old code (e.g.) mutex_destroy() was called before > pwmchip_remove(). Between these two calls it is possible that a pwm > callback is used which tries to grab the mutex. How do you think about to add a more “imperative mood” for your change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 > +++ b/drivers/pwm/pwm-omap-dmtimer.c > @@ -351,6 +351,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > static int pwm_omap_dmtimer_remove(struct platform_device *pdev) > { > struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev); > + int ret; > + > + ret = pwmchip_remove(&omap->chip); > + if (ret) > + return ret; > > if (pm_runtime_active(&omap->dm_timer_pdev->dev)) > omap->pdata->stop(omap->dm_timer); How do you think about to use the following statement variant? + int ret = pwmchip_remove(&omap->chip); Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional 2019-11-11 13:30 ` [PATCH 1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional Markus Elfring @ 2019-11-11 20:00 ` Uwe Kleine-König 2019-11-11 21:00 ` [1/4] " Markus Elfring 0 siblings, 1 reply; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 20:00 UTC (permalink / raw) To: Markus Elfring Cc: Thierry Reding, linux-pwm, Neil Brown, kernel-janitors, LKML, kernel, Neil Armstrong Hello Markus, On Mon, Nov 11, 2019 at 02:30:42PM +0100, Markus Elfring wrote: > > In the old code (e.g.) mutex_destroy() was called before > > pwmchip_remove(). Between these two calls it is possible that a pwm > > callback is used which tries to grab the mutex. > > How do you think about to add a more “imperative mood” for your > change description? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 I described the old behaviour and like my wording. > > +++ b/drivers/pwm/pwm-omap-dmtimer.c > > @@ -351,6 +351,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > > static int pwm_omap_dmtimer_remove(struct platform_device *pdev) > > { > > struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev); > > + int ret; > > + > > + ret = pwmchip_remove(&omap->chip); > > + if (ret) > > + return ret; > > > > if (pm_runtime_active(&omap->dm_timer_pdev->dev)) > > omap->pdata->stop(omap->dm_timer); > > How do you think about to use the following statement variant? > > + int ret = pwmchip_remove(&omap->chip); I think that between the declarations and code should be an empty line and between the assignment to ret and the respective check there shouldn't be one. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional 2019-11-11 20:00 ` Uwe Kleine-König @ 2019-11-11 21:00 ` Markus Elfring 0 siblings, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-11 21:00 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML >>> In the old code (e.g.) mutex_destroy() was called before >>> pwmchip_remove(). Between these two calls it is possible that a pwm >>> callback is used which tries to grab the mutex. >> >> How do you think about to add a more “imperative mood” for your >> change description? >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 > > I described the old behaviour and like my wording. I find that the first paragraph contains useful information. Would you like to specify any corresponding actions then at this place? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <20191111090357.13903-2-u.kleine-koenig@pengutronix.de>]
* Re: [PATCH 2/4] pwm: omap-dmtimer: simplify error handling [not found] ` <20191111090357.13903-2-u.kleine-koenig@pengutronix.de> @ 2019-11-11 13:32 ` Markus Elfring 2019-11-11 20:08 ` Uwe Kleine-König 0 siblings, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:32 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML > Implementation note: The put: label was never reached without a goto and > ret being unequal to 0, so the removed return statement is fine. This can look fine (in principle) because the label was repositioned here. Do you really want to call the function “of_node_put” at two places now? > +++ b/drivers/pwm/pwm-omap-dmtimer.c … > omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); > if (!omap) { > - pdata->free(dm_timer); > - return -ENOMEM; > + ret = -ENOMEM; > + goto err_alloc_omap; > } … I suggest to reconsider your label name selection according to the Linux coding style. > @@ -339,13 +334,28 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) … > +err_pwmchip_add: > + > + /* > + * *omap is allocated using devm_kzalloc, > + * so no free necessary here > + */ > +err_alloc_omap: > + > + pdata->free(dm_timer); Would the use of the label “free_dm_timer” be more appropriate? > +put: > + of_node_put(timer); … Can the label “put_node” be nicer? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] pwm: omap-dmtimer: simplify error handling 2019-11-11 13:32 ` [PATCH 2/4] pwm: omap-dmtimer: simplify error handling Markus Elfring @ 2019-11-11 20:08 ` Uwe Kleine-König 2019-11-11 21:30 ` Markus Elfring 0 siblings, 1 reply; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 20:08 UTC (permalink / raw) To: Markus Elfring Cc: linux-pwm, Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel On Mon, Nov 11, 2019 at 02:32:30PM +0100, Markus Elfring wrote: > > Implementation note: The put: label was never reached without a goto and > > ret being unequal to 0, so the removed return statement is fine. > > This can look fine (in principle) because the label was repositioned here. > Do you really want to call the function “of_node_put” at two places now? Yes, this is in my eyes more sensible. Either you have the expected path and the error path interwinded, or you have to duplicate some cleanup. IMHO the latter variant is the one that is easier to understand and the one where it's less likely to oversee a needed cleanup. > > +++ b/drivers/pwm/pwm-omap-dmtimer.c > … > > omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); > > if (!omap) { > > - pdata->free(dm_timer); > > - return -ENOMEM; > > + ret = -ENOMEM; > > + goto err_alloc_omap; > > } > … > > I suggest to reconsider your label name selection according to > the Linux coding style. Documentation/process/coding-style.rst states: "Choose label names which say what the goto does or why the goto exists." So I'd say my names are perfectly fine. > > @@ -339,13 +334,28 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > … > > +err_pwmchip_add: > > + > > + /* > > + * *omap is allocated using devm_kzalloc, > > + * so no free necessary here > > + */ > > +err_alloc_omap: > > + > > + pdata->free(dm_timer); > > Would the use of the label “free_dm_timer” be more appropriate? Either you name your labels after what the code at the label does (then "free_dm_timer" is good) or you name it after why you are here (and then err_alloc_omap is fine). I prefer the latter style and then the label name always has to correspond to the action just above it (if any). That's why I grouped the "err_alloc_omap" label to a comment saying that *omap doesn't need to be freed. > > +put: > > + of_node_put(timer); > … > > Can the label “put_node” be nicer? I agree that the label name is bad. I kept the name here and after the 3rd patch the label names are consistent. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] pwm: omap-dmtimer: simplify error handling 2019-11-11 20:08 ` Uwe Kleine-König @ 2019-11-11 21:30 ` Markus Elfring 0 siblings, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-11 21:30 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel >> Do you really want to call the function “of_node_put” at two places now? > > Yes, this is in my eyes more sensible. Thanks for this explanation. > Either you have the expected path and the error path interwinded, > and the error path interwinded, This is also reasonable then. This design approach provides the possibility to release a few resources earlier before using additional functionality. > or you have to duplicate some cleanup. * This can be required. * I imagine that specific software infrastructures can help to avoid such duplication, can't they? > IMHO the latter variant is the one that is easier to understand and the > one where it's less likely to oversee a needed cleanup. I am curious on how the clarification will be continued. >>> +++ b/drivers/pwm/pwm-omap-dmtimer.c >> … >>> omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); >>> if (!omap) { >>> - pdata->free(dm_timer); >>> - return -ENOMEM; >>> + ret = -ENOMEM; >>> + goto err_alloc_omap; >>> } >> … >> >> I suggest to reconsider your label name selection according to >> the Linux coding style. > > Documentation/process/coding-style.rst states: "Choose label names which > say what the goto does or why the goto exists." So I'd say my names are > perfectly fine. The guidance from the example after this quotation might be still too terse so far, isn't it? >>> @@ -339,13 +334,28 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) >> … >>> +err_pwmchip_add: >>> + >>> + /* >>> + * *omap is allocated using devm_kzalloc, >>> + * so no free necessary here >>> + */ >>> +err_alloc_omap: >>> + >>> + pdata->free(dm_timer); >> >> Would the use of the label “free_dm_timer” be more appropriate? > > Either you name your labels after what the code at the label does > (then "free_dm_timer" is good) I got used to this approach. > you name it after why you are here (and then err_alloc_omap is fine). This choice can trigger special software design consequences. > I prefer the latter style and then the label > name always has to correspond to the action just above it (if any). > That's why I grouped the "err_alloc_omap" label to a comment saying that > *omap doesn't need to be freed. I am also curious if any other contributors would like to share more views around this choice. >>> +put: >>> + of_node_put(timer); >> … >> >> Can the label “put_node” be nicer? > > I agree that the label name is bad. I find your agreement on this aspect interesting then. > I kept the name here and after the 3rd patch the label names are consistent. Can such an evolution be questionable? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <20191111090357.13903-3-u.kleine-koenig@pengutronix.de>]
* Re: [PATCH 3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() [not found] ` <20191111090357.13903-3-u.kleine-koenig@pengutronix.de> @ 2019-11-11 13:41 ` Markus Elfring 2019-11-11 20:09 ` Uwe Kleine-König 0 siblings, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:41 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML > This was found by coccicheck: > > drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; > call of_find_device_by_node on line 255, but without a corresponding > object release within this function. How do you think about to add a wording according to “imperative mood” for your change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 … > +++ b/drivers/pwm/pwm-omap-dmtimer.c … > @@ -352,7 +352,14 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) … > pdata->free(dm_timer); > -put: > +err_request_timer: > + > +err_timer_property: > +err_platdata: > + > + put_device(&timer_pdev->dev); Would the use of the label “put_device” be more appropriate? > +err_find_timer_pdev: > + > of_node_put(timer); … Would the use of the label “put_node” be better here? > @@ -372,6 +379,8 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev) > > omap->pdata->free(omap->dm_timer); > > + put_device(&omap->dm_timer_pdev->dev); > + > mutex_destroy(&omap->mutex); > > return 0; I suggest to omit a few blank lines. Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() 2019-11-11 13:41 ` [PATCH 3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() Markus Elfring @ 2019-11-11 20:09 ` Uwe Kleine-König 2019-11-11 21:38 ` [3/4] " Markus Elfring 0 siblings, 1 reply; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 20:09 UTC (permalink / raw) To: Markus Elfring Cc: linux-pwm, Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel On Mon, Nov 11, 2019 at 02:41:58PM +0100, Markus Elfring wrote: > > This was found by coccicheck: > > > > drivers/pwm/pwm-omap-dmtimer.c:304:2-8: ERROR: missing put_device; > > call of_find_device_by_node on line 255, but without a corresponding > > object release within this function. > > How do you think about to add a wording according to “imperative mood” > for your change description? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 Are you a bot? > > +++ b/drivers/pwm/pwm-omap-dmtimer.c > … > > @@ -352,7 +352,14 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) > … > > pdata->free(dm_timer); > > -put: > > +err_request_timer: > > + > > +err_timer_property: > > +err_platdata: > > + > > + put_device(&timer_pdev->dev); > > Would the use of the label “put_device” be more appropriate? > > > > +err_find_timer_pdev: > > + > > of_node_put(timer); > … > > Would the use of the label “put_node” be better here? > > > > @@ -372,6 +379,8 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev) > > > > omap->pdata->free(omap->dm_timer); > > > > + put_device(&omap->dm_timer_pdev->dev); > > + > > mutex_destroy(&omap->mutex); > > > > return 0; > > I suggest to omit a few blank lines. And I like it the way it is. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() 2019-11-11 20:09 ` Uwe Kleine-König @ 2019-11-11 21:38 ` Markus Elfring 2019-11-11 21:46 ` Uwe Kleine-König 0 siblings, 1 reply; 18+ messages in thread From: Markus Elfring @ 2019-11-11 21:38 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 > > Are you a bot? I hope not. But I got used to the need to point specific suggestions out several times. Would you like to mention any actions in the commit message explicitly? Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() 2019-11-11 21:38 ` [3/4] " Markus Elfring @ 2019-11-11 21:46 ` Uwe Kleine-König 2019-11-12 7:40 ` Markus Elfring 0 siblings, 1 reply; 18+ messages in thread From: Uwe Kleine-König @ 2019-11-11 21:46 UTC (permalink / raw) To: Markus Elfring Cc: linux-pwm, Neil Armstrong, Neil Brown, kernel-janitors, LKML, Thierry Reding, kernel Hello, On Mon, Nov 11, 2019 at 10:38:38PM +0100, Markus Elfring wrote: > >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 > > > > Are you a bot? > > I hope not. > > But I got used to the need to point specific suggestions out several times. And are you also used to people ignore at least n-1 of n of these repetitions? I don't feel that several near-identical mails that just include a link to some documentation is very constructive. Also I got some of your mails twice which doesn't improve the reception of your comments. > Would you like to mention any actions in the commit message explicitly? I don't understand your question, but I assume the answer is "No, I want to keep the commit log as is". Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() 2019-11-11 21:46 ` Uwe Kleine-König @ 2019-11-12 7:40 ` Markus Elfring 0 siblings, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-12 7:40 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Neil Armstrong, Neil Brown, Thierry Reding, kernel, kernel-janitors, LKML >> Would you like to mention any actions in the commit message explicitly? > > I don't understand your question, I hope that remaining communication difficulties will be resolved better. > but I assume the answer is "No, I want to keep the commit log as is". I suggest to take another look at the relevance of the corresponding Linux development documentation then. Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <20191111090357.13903-4-u.kleine-koenig@pengutronix.de>]
* Re: [PATCH 4/4] pwm: omap-dmtimer: Allow compiling with COMPILE_TEST [not found] ` <20191111090357.13903-4-u.kleine-koenig@pengutronix.de> @ 2019-11-11 13:47 ` Markus Elfring 2019-11-11 13:47 ` Markus Elfring 1 sibling, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:47 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML > The dependency on OMAP_DM_TIMER is only a runtime dependency. Also > OMAP_DM_TIMER cannot be enabled without ARCH_OMAP being enabled. Will a more “imperative mood” become relevant also for this change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/4] pwm: omap-dmtimer: Allow compiling with COMPILE_TEST [not found] ` <20191111090357.13903-4-u.kleine-koenig@pengutronix.de> 2019-11-11 13:47 ` [PATCH 4/4] pwm: omap-dmtimer: Allow compiling with COMPILE_TEST Markus Elfring @ 2019-11-11 13:47 ` Markus Elfring 1 sibling, 0 replies; 18+ messages in thread From: Markus Elfring @ 2019-11-11 13:47 UTC (permalink / raw) To: Uwe Kleine-König, linux-pwm Cc: Thierry Reding, Neil Brown, Neil Armstrong, kernel, kernel-janitors, LKML > The dependency on OMAP_DM_TIMER is only a runtime dependency. Also > OMAP_DM_TIMER cannot be enabled without ARCH_OMAP being enabled. Will a more “imperative mood” become relevant also for this change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151 Regards, Markus ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-11-12 7:40 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-09 12:26 [PATCH] pwm: omap-dmtimer: Add missing put_device() call in pwm_omap_dmtimer_probe() Markus Elfring 2019-11-11 7:19 ` Uwe Kleine-König [not found] ` <20191111090357.13903-1-u.kleine-koenig@pengutronix.de> [not found] ` <20191111091606.qf7gj5gln3khfnsl@pengutronix.de> 2019-11-11 13:28 ` [0/4] pwm: omap-dmtimer: Software improvements Markus Elfring 2019-11-11 13:28 ` Markus Elfring 2019-11-11 19:57 ` Uwe Kleine-König 2019-11-11 13:30 ` [PATCH 1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional Markus Elfring 2019-11-11 20:00 ` Uwe Kleine-König 2019-11-11 21:00 ` [1/4] " Markus Elfring [not found] ` <20191111090357.13903-2-u.kleine-koenig@pengutronix.de> 2019-11-11 13:32 ` [PATCH 2/4] pwm: omap-dmtimer: simplify error handling Markus Elfring 2019-11-11 20:08 ` Uwe Kleine-König 2019-11-11 21:30 ` Markus Elfring [not found] ` <20191111090357.13903-3-u.kleine-koenig@pengutronix.de> 2019-11-11 13:41 ` [PATCH 3/4] pwm: omap-dmtimer: put_device() after of_find_device_by_node() Markus Elfring 2019-11-11 20:09 ` Uwe Kleine-König 2019-11-11 21:38 ` [3/4] " Markus Elfring 2019-11-11 21:46 ` Uwe Kleine-König 2019-11-12 7:40 ` Markus Elfring [not found] ` <20191111090357.13903-4-u.kleine-koenig@pengutronix.de> 2019-11-11 13:47 ` [PATCH 4/4] pwm: omap-dmtimer: Allow compiling with COMPILE_TEST Markus Elfring 2019-11-11 13:47 ` Markus Elfring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).