From: Dan Carpenter <dan.carpenter@linaro.org>
To: Su Hui <suhui@nfschina.com>
Cc: airlied@redhat.com, kraxel@redhat.com,
gurchetansingh@chromium.org, olvaffe@gmail.com, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/virtio: remove some redundant code
Date: Wed, 12 Jul 2023 09:36:41 +0300 [thread overview]
Message-ID: <b82057bf-3126-4721-87f5-79ca3682cee4@kadam.mountain> (raw)
In-Reply-To: <0561b89b-42a8-35bf-feaa-e5feb4ec3cd5@nfschina.com>
On Wed, Jul 12, 2023 at 09:18:42AM +0800, Su Hui wrote:
> On 2023/7/11 19:13, Dan Carpenter wrote:
> > On Tue, Jul 11, 2023 at 05:00:31PM +0800, Su Hui wrote:
> > > virtio_gpu_get_vbuf always be successful,
> > > so remove the error judgment.
> > >
> > No, just ignore the static checker false positive in this case. The
> > intent of the code is clear that if it did have an error it should
> > return an error pointer.
>
> Hi, Dan,
>
> Function "virtio_gpu_get_vbuf" call "kmem_cache_zalloc (vgdev->vbufs,
> GFP_KERNEL | __GFP_NOFAIL)" to
> allocate memory. Adding the " __GFP_NOFAIL”flag make sure it won't fail. And
> "virtio_gpu_get_vbuf" never
> return an error code, so I think this is not a false positive.
We all see this and agree.
However the check for if (IS_ERR()) is written deliberately because we
might change the code to return error pointers in the future. Static
checkers are looking for code that does something unintentional but in
this case the code was written that way deliberately.
regards,
dan carpenter
next prev parent reply other threads:[~2023-07-12 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 9:00 Su Hui
2023-07-11 11:13 ` Dan Carpenter
2023-07-12 1:18 ` Su Hui
2023-07-12 6:36 ` Dan Carpenter [this message]
2023-07-12 10:15 ` Su Hui
[not found] <6baf8384-af7a-06e1-6f91-8c4e8aa65197@web.de>
2023-07-12 1:26 ` Su Hui
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=b82057bf-3126-4721-87f5-79ca3682cee4@kadam.mountain \
--to=dan.carpenter@linaro.org \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olvaffe@gmail.com \
--cc=suhui@nfschina.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®