From: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
"Alexandru Gheorghiu" <gheorghiuandru@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH] drivers: virtio: Use PTR_RET function
Date: Tue, 26 Mar 2013 13:57:09 +1030 [thread overview]
Message-ID: <87fvzidenm.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1364217936-6284-1-git-send-email-gheorghiuandru@gmail.com>
Alexandru Gheorghiu <gheorghiuandru@gmail.com> writes:
> Used PTR_RET function instead of IS_ERR and PTR_ERR.
> Patch found using coccinelle.
WTF is PTR_RET? PTR_RET doesn't return anything. Why is it called
that? It doesn't even make sense.
ZERO_OR_PTR_ERR() maybe.
But what problem are we solving? Insufficient churn in the tree? Code
being too readable? This isn't some hard-to-get right corner case, or a
missed optimization.
Andrew, what am I missing here?
Grumpy,
Rusty.
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
> ---
> drivers/virtio/virtio_mmio.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 1ba0d68..d1e664f 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -567,10 +567,7 @@ static int vm_cmdline_set(const char *device,
> pdev = platform_device_register_resndata(&vm_cmdline_parent,
> "virtio-mmio", vm_cmdline_id++,
> resources, ARRAY_SIZE(resources), NULL, 0);
> - if (IS_ERR(pdev))
> - return PTR_ERR(pdev);
> -
> - return 0;
> + return PTR_RET(pdev);
> }
>
> static int vm_cmdline_get_device(struct device *dev, void *data)
> --
> 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: Rusty Russell <rusty@rustcorp.com.au>
To: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
"Alexandru Gheorghiu" <gheorghiuandru@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH] drivers: virtio: Use PTR_RET function
Date: Tue, 26 Mar 2013 13:57:09 +1030 [thread overview]
Message-ID: <87fvzidenm.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1364217936-6284-1-git-send-email-gheorghiuandru@gmail.com>
Alexandru Gheorghiu <gheorghiuandru@gmail.com> writes:
> Used PTR_RET function instead of IS_ERR and PTR_ERR.
> Patch found using coccinelle.
WTF is PTR_RET? PTR_RET doesn't return anything. Why is it called
that? It doesn't even make sense.
ZERO_OR_PTR_ERR() maybe.
But what problem are we solving? Insufficient churn in the tree? Code
being too readable? This isn't some hard-to-get right corner case, or a
missed optimization.
Andrew, what am I missing here?
Grumpy,
Rusty.
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
> ---
> drivers/virtio/virtio_mmio.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 1ba0d68..d1e664f 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -567,10 +567,7 @@ static int vm_cmdline_set(const char *device,
> pdev = platform_device_register_resndata(&vm_cmdline_parent,
> "virtio-mmio", vm_cmdline_id++,
> resources, ARRAY_SIZE(resources), NULL, 0);
> - if (IS_ERR(pdev))
> - return PTR_ERR(pdev);
> -
> - return 0;
> + return PTR_RET(pdev);
> }
>
> static int vm_cmdline_get_device(struct device *dev, void *data)
> --
> 1.7.9.5
next prev parent reply other threads:[~2013-03-26 3:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 13:25 [PATCH] drivers: virtio: Use PTR_RET function Alexandru Gheorghiu
2013-03-26 3:27 ` Rusty Russell [this message]
2013-03-26 3:27 ` Rusty Russell
2013-03-26 5:01 ` Andrew Morton
2013-03-26 5:01 ` Andrew Morton
2013-03-26 7:41 ` Andru Gheorghiu
2013-03-26 10:23 ` Rusty Russell
2013-03-26 10:23 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2013-03-25 13:25 Alexandru Gheorghiu
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=87fvzidenm.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=gheorghiuandru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.