From: dacohen@gmail.com (David Cohen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 05/19] OMAP3+: voltage: use IS_ERR_OR_NULL
Date: Sat, 5 Mar 2011 19:36:04 +0200 [thread overview]
Message-ID: <AANLkTi=q_ASfvLbZv=D8p3XvuMX8ek3hcEHU5wtfkm7J@mail.gmail.com> (raw)
In-Reply-To: <1299338962-5602-6-git-send-email-nm@ti.com>
Hi Nishanth,
On Sat, Mar 5, 2011 at 5:29 PM, Nishanth Menon <nm@ti.com> wrote:
> Use IS_ERR_OR_NULL macro instead of !xyz || IS_ERR(xyz) usage.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> ?arch/arm/mach-omap2/voltage.c | ? 22 +++++++++++-----------
> ?1 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
> index 53c399f..76bcaee 100644
> --- a/arch/arm/mach-omap2/voltage.c
> +++ b/arch/arm/mach-omap2/voltage.c
> @@ -682,7 +682,7 @@ unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm)
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
I have one comment here. voltdm is received as parameter and it's
already checked by IS_ERR(). Is there any specific reason for that?
IS_ERR() doesn't suppose to be a macro to check if the pointer is
valid or not, but to know if there's an invalid value with error code
in the pointer value. It's useful when you have a function which
returns a pointer but it can return an error code when it fails.
Please, note that IS_ERR() won't detect invalid pointers which does
not represent an error code, so it's not correct to rely on it for
this purpose.
IMO, instead of change to IS_ERR_OR_NULL(), you could only remove
IS_ERR(). The same apply for the other cases.
Kind regards,
David Cohen
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
> @@ -703,7 +703,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
> ? ? ? ?struct omap_vdd_info *vdd;
> ? ? ? ?u8 curr_vsel;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return 0;
> ? ? ? ?}
> @@ -738,7 +738,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
> ? ? ? ?struct omap_vdd_info *vdd;
> ? ? ? ?u32 vpconfig;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> @@ -776,7 +776,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
> ? ? ? ?u32 vpconfig;
> ? ? ? ?int timeout;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> @@ -829,7 +829,7 @@ int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
> @@ -858,7 +858,7 @@ void omap_voltage_reset(struct voltagedomain *voltdm)
> ?{
> ? ? ? ?unsigned long target_uvdc;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> @@ -890,7 +890,7 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> @@ -921,7 +921,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
> ? ? ? ?struct omap_vdd_info *vdd;
> ? ? ? ?int i;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return ERR_PTR(-EINVAL);
> ? ? ? ?}
> @@ -959,7 +959,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return -EINVAL;
> ? ? ? ?}
> @@ -986,7 +986,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return NULL;
> ? ? ? ?}
> @@ -1011,7 +1011,7 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
> ?{
> ? ? ? ?struct omap_vdd_info *vdd;
>
> - ? ? ? if (!voltdm || IS_ERR(voltdm)) {
> + ? ? ? if (IS_ERR_OR_NULL(voltdm)) {
> ? ? ? ? ? ? ? ?pr_warning("%s: VDD specified does not exist!\n", __func__);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2011-03-05 17:36 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-05 15:29 [PATCH V3 00/19] OMAP3+: PM: introduce SR class 1.5 Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 01/19] OMAP3: hwmod: add SmartReflex IRQs Nishanth Menon
2011-03-17 14:41 ` Kevin Hilman
2011-07-26 13:11 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 02/19] OMAP3+: voltage: fix build warning Nishanth Menon
2011-03-17 14:49 ` Kevin Hilman
2011-07-26 13:12 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 03/19] OMAP3+: voltage: remove initial voltage Nishanth Menon
2011-03-06 13:37 ` Sergei Shtylyov
2011-03-07 2:52 ` Nishanth Menon
2011-03-07 16:23 ` Sergei Shtylyov
2011-03-08 1:52 ` Nishanth Menon
2011-07-26 13:17 ` Felipe Balbi
2011-03-17 14:53 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 04/19] OMAP3+: voltage: remove spurious pr_notice for debugfs Nishanth Menon
2011-03-17 14:55 ` Kevin Hilman
2011-07-26 13:18 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 05/19] OMAP3+: voltage: use IS_ERR_OR_NULL Nishanth Menon
2011-03-05 17:36 ` David Cohen [this message]
2011-03-06 2:45 ` Nishanth Menon
2011-03-06 8:18 ` Russell King - ARM Linux
2011-03-07 2:56 ` Nishanth Menon
2011-07-26 13:19 ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 06/19] OMAP3+: voltage: use volt_data pointer instead values Nishanth Menon
2011-03-17 17:09 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 07/19] OMAP3+: voltage: add transdone APIs Nishanth Menon
2011-03-17 17:14 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 08/19] OMAP3+: SR: make notify independent of class Nishanth Menon
2011-03-17 17:18 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 09/19] OMAP3+: SR: disable interrupt by default Nishanth Menon
2011-03-17 17:19 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 10/19] OMAP3+: SR: enable/disable SR only on need Nishanth Menon
2011-03-17 17:20 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 11/19] OMAP3+: SR: fix cosmetic indentation Nishanth Menon
2011-03-17 17:21 ` Kevin Hilman
2011-03-17 17:43 ` Aaro Koskinen
2011-03-17 20:02 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start, stop and priv data Nishanth Menon
2011-03-17 17:23 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 13/19] OMAP3+: SR: Reuse sr_[start|stop]_vddautocomp functions Nishanth Menon
2011-03-07 14:40 ` Jarkko Nikula
2011-03-17 17:25 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 14/19] OMAP3+: SR: introduce notifiers flags Nishanth Menon
2011-03-17 17:28 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 15/19] OMAP3+: SR: introduce notifier_control Nishanth Menon
2011-03-17 17:35 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 16/19] OMAP3+: SR: disable spamming interrupts Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 17/19] OMAP3+: SR: make enable path use volt_data pointer Nishanth Menon
2011-03-17 17:41 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 18/19] OMAP3630+: SR: add support for class 1.5 Nishanth Menon
2011-03-17 19:57 ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 19/19] OMAP3430: SR: class3: restrict CPU to run on Nishanth Menon
2011-03-17 19:58 ` Kevin Hilman
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='AANLkTi=q_ASfvLbZv=D8p3XvuMX8ek3hcEHU5wtfkm7J@mail.gmail.com' \
--to=dacohen@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).