* [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" [not found] ` <5317A59D.4@users.sourceforge.net> @ 2015-11-05 16:17 ` SF Markus Elfring 2015-11-05 16:53 ` Ray Jui 2015-11-17 10:50 ` Linus Walleij 0 siblings, 2 replies; 3+ messages in thread From: SF Markus Elfring @ 2015-11-05 16:17 UTC (permalink / raw) To: Jon Mason, Linus Walleij, Ray Jui, Scott Branden, linux-gpio, linux-arm-kernel, bcm-kernel-feedback-list Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 5 Nov 2015 17:10:22 +0100 The pinctrl_unregister() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 3 +-- drivers/pinctrl/pinctrl-single.c | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c index 12a48f4..663ad0a 100644 --- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c @@ -638,8 +638,7 @@ static int cygnus_gpio_register_pinconf(struct cygnus_gpio *chip) static void cygnus_gpio_unregister_pinconf(struct cygnus_gpio *chip) { - if (chip->pctl) - pinctrl_unregister(chip->pctl); + pinctrl_unregister(chip->pctl); } struct cygnus_gpio_data { diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index ef04b96..d24e5f1 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1484,10 +1484,7 @@ static void pcs_irq_free(struct pcs_device *pcs) static void pcs_free_resources(struct pcs_device *pcs) { pcs_irq_free(pcs); - - if (pcs->pctl) - pinctrl_unregister(pcs->pctl); - + pinctrl_unregister(pcs->pctl); pcs_free_funcs(pcs); pcs_free_pingroups(pcs); } -- 2.6.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" 2015-11-05 16:17 ` [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" SF Markus Elfring @ 2015-11-05 16:53 ` Ray Jui 2015-11-17 10:50 ` Linus Walleij 1 sibling, 0 replies; 3+ messages in thread From: Ray Jui @ 2015-11-05 16:53 UTC (permalink / raw) To: SF Markus Elfring, Jon Mason, Linus Walleij, Scott Branden, linux-gpio, linux-arm-kernel, bcm-kernel-feedback-list Cc: LKML, kernel-janitors, Julia Lawall, Pramod Kumar On 11/5/2015 8:17 AM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 5 Nov 2015 17:10:22 +0100 > > The pinctrl_unregister() function tests whether its argument is NULL > and then returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 3 +-- > drivers/pinctrl/pinctrl-single.c | 5 +---- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c > index 12a48f4..663ad0a 100644 > --- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c > +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c > @@ -638,8 +638,7 @@ static int cygnus_gpio_register_pinconf(struct cygnus_gpio *chip) > > static void cygnus_gpio_unregister_pinconf(struct cygnus_gpio *chip) > { > - if (chip->pctl) > - pinctrl_unregister(chip->pctl); > + pinctrl_unregister(chip->pctl); > } > > struct cygnus_gpio_data { > diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c > index ef04b96..d24e5f1 100644 > --- a/drivers/pinctrl/pinctrl-single.c > +++ b/drivers/pinctrl/pinctrl-single.c > @@ -1484,10 +1484,7 @@ static void pcs_irq_free(struct pcs_device *pcs) > static void pcs_free_resources(struct pcs_device *pcs) > { > pcs_irq_free(pcs); > - > - if (pcs->pctl) > - pinctrl_unregister(pcs->pctl); > - > + pinctrl_unregister(pcs->pctl); > pcs_free_funcs(pcs); > pcs_free_pingroups(pcs); > } > The change looks good to me, thanks! Reviewed-by: Ray Jui <rjui@broadcom.com> + Pramod since he's working on changes on the pinctrl-cygnus-gpio driver. Ray ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" 2015-11-05 16:17 ` [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" SF Markus Elfring 2015-11-05 16:53 ` Ray Jui @ 2015-11-17 10:50 ` Linus Walleij 1 sibling, 0 replies; 3+ messages in thread From: Linus Walleij @ 2015-11-17 10:50 UTC (permalink / raw) To: SF Markus Elfring Cc: Jon Mason, Ray Jui, Scott Branden, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list, LKML, kernel-janitors, Julia Lawall On Thu, Nov 5, 2015 at 5:17 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 5 Nov 2015 17:10:22 +0100 > > The pinctrl_unregister() function tests whether its argument is NULL > and then returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Patch applied with Ray's Review tag. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-17 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.sourceforge.net>
2015-11-05 16:17 ` [PATCH] pinctrl: Delete unnecessary checks before the function call "pinctrl_unregister" SF Markus Elfring
2015-11-05 16:53 ` Ray Jui
2015-11-17 10:50 ` Linus Walleij
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).