All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Mike Marciniszyn
	<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V2] IB/qib: fix test of unsigned variable
Date: Tue, 12 May 2015 12:45:14 -0400	[thread overview]
Message-ID: <1431449114.43876.57.camel@redhat.com> (raw)
In-Reply-To: <20150512163233.26836.98544.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]

On Tue, 2015-05-12 at 12:32 -0400, Mike Marciniszyn wrote:
> Commit d4988623cc60 ("IB/qib: use arch_phys_wc_add()")
> adjusted mtrr inititialization to use the new interface.
> 
> Unfortunately, the new interface returns a signed
> value and the patch tested the unsigned wc_cookie.
> 
> Fix the issue by changing the type of wc_cookie to int.  For
> the success case the ret is changed to zero to avoid
> a warning from the caller.  For failure wc_cookie
> is used as the ret.
> 
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/qib/qib.h           |    2 +-
>  drivers/infiniband/hw/qib/qib_wc_x86_64.c |    8 ++++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
> index ba5173e2..7df16f7 100644
> --- a/drivers/infiniband/hw/qib/qib.h
> +++ b/drivers/infiniband/hw/qib/qib.h
> @@ -903,7 +903,7 @@ struct qib_devdata {
>  	/* PCI Device ID (here for NodeInfo) */
>  	u16 deviceid;
>  	/* for write combining settings */
> -	unsigned long wc_cookie;
> +	int wc_cookie;
>  	unsigned long wc_base;
>  	unsigned long wc_len;
>  
> diff --git a/drivers/infiniband/hw/qib/qib_wc_x86_64.c b/drivers/infiniband/hw/qib/qib_wc_x86_64.c
> index 6d61ef9..2f2e15a 100644
> --- a/drivers/infiniband/hw/qib/qib_wc_x86_64.c
> +++ b/drivers/infiniband/hw/qib/qib_wc_x86_64.c
> @@ -117,8 +117,12 @@ int qib_enable_wc(struct qib_devdata *dd)
>  
>  	if (!ret) {
>  		dd->wc_cookie = arch_phys_wc_add(pioaddr, piolen);
> -		if (dd->wc_cookie < 0)
> -			ret = -EINVAL;
> +		if (dd->wc_cookie >= 0)
> +			/* insure no warning on success */
> +			ret = 0;

This stanza has no meaning.  ret was already 0 or we wouldn't be in this
section, setting it again serves no purpose.  Just keep the original
code, but replace -EINVAL with dd->wc_cookie.

> +		else
> +			/* use error from routine */
> +			ret = dd->wc_cookie;
>  	}
>  
>  	return ret;
> 


-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-05-12 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 16:32 [PATCH V2] IB/qib: fix test of unsigned variable Mike Marciniszyn
     [not found] ` <20150512163233.26836.98544.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-05-12 16:45   ` Doug Ledford [this message]
     [not found]     ` <1431449114.43876.57.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-12 17:38       ` Marciniszyn, Mike

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=1431449114.43876.57.camel@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.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.