public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Andi Shyti <andi.shyti@linux.intel.com>
Cc: "Chris Wilson" <chris@chris-wilson.co.uk>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/i915/selftests: fix an error code in copy()
Date: Fri, 26 May 2023 16:14:25 +0300	[thread overview]
Message-ID: <6b5fd74c-b98f-4e97-a562-e9739fd03873@kili.mountain> (raw)
In-Reply-To: <ZHCs2RU6+SNkq0GA@ashyti-mobl2.lan>

On Fri, May 26, 2023 at 02:58:01PM +0200, Andi Shyti wrote:
> Hi Dan,
> 
> On Fri, May 26, 2023 at 02:59:31PM +0300, Dan Carpenter wrote:
> > Return the error code if i915_gem_object_create_internal() fails,
> > instead of returning success.
> > 
> > Fixes: cf586021642d ("drm/i915/gt: Pipelined page migration")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >  drivers/gpu/drm/i915/gt/selftest_migrate.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > index e677f2da093d..a26429fd5326 100644
> > --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > @@ -55,8 +55,10 @@ static int copy(struct intel_migrate *migrate,
> >  
> >  	sz = src->base.size;
> >  	dst = i915_gem_object_create_internal(i915, sz);
> > -	if (IS_ERR(dst))
> > +	if (IS_ERR(dst)) {
> > +		err = PTR_ERR(dst);
> >  		goto err_free_src;
> > +	}
> 
> I think it was intentional to return '0' when
> i915_gem_object_create_internal() failed, as we are not testing
> object creation here.
> 
> I don't really mind this patch, but, on the other hand, returning
> an error value here might provide a biased information.

Something we could consider is to make it more obvious that it's
intentional.  Smatch counts it as intentional if there is an "err = 0;"
within a few lines of the goto.

But let's just leave it.  I've already marked this static checker
warning as dealt with.  If I see it again and maybe that will motivate
me to add an err = 0; assignment.  People imagine that kernel code must
be 100% perfect with no static checker warnings etc but really it's
almost the weekend and this is fine.

regards,
dan carpenter


  reply	other threads:[~2023-05-26 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 11:59 [PATCH] drm/i915/selftests: fix an error code in copy() Dan Carpenter
2023-05-26 12:58 ` Andi Shyti
2023-05-26 13:14   ` Dan Carpenter [this message]
2023-05-26 14:52     ` Andi Shyti

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=6b5fd74c-b98f-4e97-a562-e9739fd03873@kili.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=airlied@gmail.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tvrtko.ursulin@linux.intel.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