Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1263481 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2015-11-05 19:50 +0100 |
| Last post | 2015-11-06 09:00 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-05 19:50 +0100
[PATCH 1/2] [media] c8sectpfe: Delete unnecessary checks before two function calls SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-05 20:00 +0100
[PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-05 20:00 +0100
Re: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block walter harms <wharms@bfs.de> - 2015-11-06 11:10 +0100
Re: [PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks Maxime Coquelin <maxime.coquelin@st.com> - 2015-11-06 09:00 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-05 19:50 +0100 |
| Subject | [PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks |
| Message-ID | <qrxLI-1UB-13@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 5 Nov 2015 19:39:32 +0100 Another update suggestion was taken into account after a patch was applied from static source code analysis. Markus Elfring (2): Delete unnecessary checks before two function calls Combine three checks into a single if block drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-05 20:00 +0100 |
| Subject | [PATCH 1/2] [media] c8sectpfe: Delete unnecessary checks before two function calls |
| Message-ID | <qrxVn-1Y0-1@gated-at.bofh.it> |
| In reply to | #1263481 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Nov 2015 18:55:19 +0100
The functions i2c_put_adapter() and module_put() test whether their
argument is NULL and then return immediately.
Thus the tests around their calls are not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
index 95223ab..07fd6d9 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
@@ -214,12 +214,11 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe,
dvb_frontend_detach(tsin->frontend);
}
- if (tsin && tsin->i2c_adapter)
+ if (tsin)
i2c_put_adapter(tsin->i2c_adapter);
if (tsin && tsin->i2c_client) {
- if (tsin->i2c_client->dev.driver->owner)
- module_put(tsin->i2c_client->dev.driver->owner);
+ module_put(tsin->i2c_client->dev.driver->owner);
i2c_unregister_device(tsin->i2c_client);
}
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-05 20:00 +0100 |
| Subject | [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block |
| Message-ID | <qrxVn-1Y0-15@gated-at.bofh.it> |
| In reply to | #1263481 |
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 (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);
+ }
}
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | walter harms <wharms@bfs.de> |
|---|---|
| Date | 2015-11-06 11:10 +0100 |
| Subject | Re: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single if block |
| Message-ID | <qrM82-36S-43@gated-at.bofh.it> |
| In reply to | #1263487 |
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);
> + }
> }
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Maxime Coquelin <maxime.coquelin@st.com> |
|---|---|
| Date | 2015-11-06 09:00 +0100 |
| Subject | Re: [PATCH 0/2] [media] c8sectpfe: Deletion of a few unnecessary checks |
| Message-ID | <qrK6e-1Ca-13@gated-at.bofh.it> |
| In reply to | #1263481 |
Hi Markus, On 11/05/2015 07:45 PM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 5 Nov 2015 19:39:32 +0100 > > Another update suggestion was taken into account after a patch was applied > from static source code analysis. > > Markus Elfring (2): > Delete unnecessary checks before two function calls > Combine three checks into a single if block > > drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > For the series: Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Thanks! Maxime -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web