From: walter harms <wharms@bfs.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Maxime Coquelin <maxime.coquelin@st.com>,
Patrice Chotard <patrice.chotard@st.com>,
Srinivas Kandagatla <srinivas.kandagatla@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org, kernel@stlinux.com,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block
Date: Fri, 06 Nov 2015 11:09:29 +0100 [thread overview]
Message-ID: <563C7C59.8020907@bfs.de> (raw)
In-Reply-To: <563BA50C.4060303@users.sourceforge.net>
Am 05.11.2015 19:50, schrieb SF Markus Elfring:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Nov 2015 19:23:50 +0100
>
> The variable "tsin" was checked three times in a loop iteration of the
> c8sectpfe_tuner_unregister_frontend() function.
> This implementation detail could be improved by the combination of the
> involved statements into a single if block so that this variable will be
> checked only once there.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> index 07fd6d9..2dfbe8a 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> @@ -209,17 +209,18 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe,
>
> tsin = fei->channel_data[n];
if you do "if (!tsin) continue ;"
you can save one indent level
re,
wh
>
> - if (tsin && tsin->frontend) {
> - dvb_unregister_frontend(tsin->frontend);
> - dvb_frontend_detach(tsin->frontend);
> - }
> + if (tsin) {
> + if (tsin->frontend) {
> + dvb_unregister_frontend(tsin->frontend);
> + dvb_frontend_detach(tsin->frontend);
> + }
>
> - if (tsin)
> i2c_put_adapter(tsin->i2c_adapter);
>
> - if (tsin && tsin->i2c_client) {
> - module_put(tsin->i2c_client->dev.driver->owner);
> - i2c_unregister_device(tsin->i2c_client);
> + if (tsin->i2c_client) {
> + module_put(tsin->i2c_client->dev.driver->owner);
> + i2c_unregister_device(tsin->i2c_client);
> + }
> }
> }
>
next prev parent reply other threads:[~2015-11-06 10:19 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
[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>
2014-11-20 8:19 ` [PATCH 0/3] [media] DVB-frontends: Deletion of a few unnecessary checks SF Markus Elfring
2014-11-20 8:29 ` [PATCH 2/3] [media] m88ds3103: One function call less in m88ds3103_init() after error detection SF Markus Elfring
2014-11-20 8:33 ` [PATCH 1/3] [media] DVB-frontends: Deletion of unnecessary checks before the function call "release_firmware" SF Markus Elfring
2014-11-20 8:39 ` [PATCH 3/3] [media] si2168: One function call less in si2168_init() after error detection SF Markus Elfring
2014-11-20 9:55 ` [PATCH 1/1] [media] firewire: Deletion of an unnecessary check before the function call "dvb_unregister_device" SF Markus Elfring
2014-11-20 14:41 ` Stefan Richter
2014-11-20 10:20 ` [PATCH 1/1] [media] i2c: Deletion of an unnecessary check before the function call "rc_unregister_device" SF Markus Elfring
2014-11-20 10:50 ` [PATCH 1/1] [media] platform: Deletion of unnecessary checks before two function calls SF Markus Elfring
2014-11-20 12:08 ` [PATCH 1/1] [media] rc: " SF Markus Elfring
2014-11-20 12:33 ` [PATCH 1/1] [media] USB: Deletion of unnecessary checks before three " SF Markus Elfring
2014-11-24 21:40 ` [PATCH 1/1] [media] Siano: Deletion of an unnecessary check before the function call "rc_unregister_device" SF Markus Elfring
2014-11-30 20:21 ` [PATCH 0/2] [media] tuners: Deletion of two unnecessary checks SF Markus Elfring
2014-11-30 20:25 ` [PATCH 1/2] [media] tuners: Deletion of unnecessary checks before the function call "release_firmware" SF Markus Elfring
2014-11-30 20:28 ` [PATCH 2/2] [media] tuners-si2157: One function call less in si2157_init() after error detection SF Markus Elfring
2014-11-30 21:55 ` [PATCH 1/1] [media] ddbridge: Deletion of an unnecessary check before the function call "dvb_unregister_device" SF Markus Elfring
2014-11-30 22:23 ` [PATCH 1/1] [media] V4L2: Deletion of an unnecessary check before the function call "vb2_put_vma" SF Markus Elfring
2014-12-01 9:46 ` Marek Szyprowski
2014-12-01 18:55 ` [PATCH 1/1] [media] lirc_zilog: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
2014-12-01 22:30 ` [PATCH 0/2] [media] mn88473: Delete an unnecessary check SF Markus Elfring
2014-12-01 22:33 ` [PATCH 1/2] [media] mn88473: Deletion of an unnecessary check before the function call "release_firmware" SF Markus Elfring
2014-12-01 22:35 ` [PATCH 2/2] [media] mn88473: One function call less in mn88473_init() after error detection SF Markus Elfring
2015-02-01 19:11 ` [PATCH 0/2] [media] mn88472: Delete an unnecessary check SF Markus Elfring
2015-02-01 19:16 ` [PATCH 1/2] [media] mn88472: Deletion of an unnecessary check before the function call "release_firmware" SF Markus Elfring
2015-02-01 19:18 ` [PATCH 2/2] [media] mn88472: One function call less in mn88472_init() after error detection SF Markus Elfring
2015-02-02 12:44 ` [media] staging: bcm2048: Delete an unnecessary check before the function call "video_unregister_device" SF Markus Elfring
2015-02-03 14:10 ` [PATCH] [media] sp2: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-02-03 14:31 ` [PATCH] [media] V4L2: Delete an unnecessary check before the function call "media_entity_put" SF Markus Elfring
2015-02-03 16:18 ` [PATCH 0/2] DVB: Deletion of a few unnecessary checks SF Markus Elfring
2015-02-03 16:22 ` [PATCH 1/2] [media] DVB: Delete an unnecessary check before the function call "dvb_unregister_device" SF Markus Elfring
2015-02-03 16:23 ` [PATCH 2/2] [media] DVB: Less function calls in dvb_ca_en50221_init() after error detection SF Markus Elfring
2015-02-03 17:45 ` [PATCH] [media] stk-webcam: Delete an unnecessary check before the function call "vfree" SF Markus Elfring
2015-02-03 18:03 ` [PATCH] [media] au0828: Delete unnecessary checks before the function call "video_unregister_device" SF Markus Elfring
2015-11-05 18:45 ` [PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks SF Markus Elfring
2015-11-05 18:49 ` [PATCH 1/2] [media] c8sectpfe: Delete unnecessary checks before two function calls SF Markus Elfring
2015-11-05 18:50 ` [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block SF Markus Elfring
2015-11-06 10:09 ` walter harms [this message]
2015-11-06 7:50 ` [PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks Maxime Coquelin
2016-07-17 20:16 ` [PATCH] [media] tw686x-kh: Delete an unnecessary check before the function call "video_unregister_device" SF Markus Elfring
2016-07-22 10:16 ` Krzysztof Hałasa
2016-07-17 21:00 ` [PATCH] [media] cec: Delete an unnecessary check before the function call "rc_free_device" SF Markus Elfring
2016-07-19 18:02 ` [PATCH] [media] v4l2-common: Delete an unnecessary check before the function call "spi_unregister_device" SF Markus Elfring
2016-07-19 18:36 ` walter harms
2016-07-19 19:35 ` [PATCH] [media] tw686x: Delete an unnecessary check before the function call "video_unregister_device" SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=563C7C59.8020907@bfs.de \
--to=wharms@bfs.de \
--cc=elfring@users.sourceforge.net \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel@stlinux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=mchehab@osg.samsung.com \
--cc=patrice.chotard@st.com \
--cc=srinivas.kandagatla@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).