IB/qib: fix test of unsigned variable
PATCH v2 1/1 IB/qib: fix test of unsigned variable
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.
--- drivers/infiniband/hw/qib/qib.h | 2 +- drivers/infiniband/hw/qib/qib_wc_x86_64.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/hw/qib/qib.h +1 -1
@@ -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;
drivers/infiniband/hw/qib/qib_wc_x86_64.c +6 -2
@@ -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 ; +else +/* use error from routine */ + ret = dd->wc_cookie; }return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20150512163233.26836.98544.stgit-K+u1se/DcYrLESAwzcoQNrvm/[email protected]
Quoted 35 lines · Mike Marciniszyn
Commit
d4988623cc60("IB/qib: usearch_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_cookieto int. For the success case the ret is changed to zero to avoid a warning from the caller. For failurewc_cookieis used as the ret.Signed-off-by Mike Marciniszyn <[email protected]>--- drivers/infiniband/hw/qib/qib.h | 2 +- drivers/infiniband/hw/qib/qib_wc_x86_64.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)drivers/infiniband/hw/qib/qib.h +1
-1@@ -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;drivers/infiniband/hw/qib/qib_wc_x86_64.c +0
-0
drivers/infiniband/hw/qib/qib_wc_x86_64.c int qib_enable_wc(struct qib_devdata *dd) · line 122
Quoted 8 lines
drivers/infiniband/hw/qib/qib_wc_x86_64.c +3
-2@@ -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.
Quoted 7 lines
drivers/infiniband/hw/qib/qib_wc_x86_64.c +3
-0+else +/* use error from routine */ + ret = dd->wc_cookie; }return ret;
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
A message that is not in the archive (sent off-list or not yet received): 1431449114.43876.57.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
PiBUaGlzIHN0YW56YSBoYXMgbm8gbWVhbmluZy4gIHJldCB3YXMgYWxyZWFkeSAwIG9yIHdlIHdv dWxkbid0IGJlIGluIHRoaXMgc2VjdGlvbiwNCj4gc2V0dGluZyBpdCBhZ2FpbiBzZXJ2ZXMgbm8g cHVycG9zZS4gIEp1c3Qga2VlcCB0aGUgb3JpZ2luYWwgY29kZSwgYnV0IHJlcGxhY2UgLQ0KPiBF SU5WQUwgd2l0aCBkZC0+d2NfY29va2llLg0KPiANCg0KRHVoLg0KDQpWMyB3aWxsIGZpeC4NCg0K TWlrZQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html