Message ID | 1374050453.26384.41.camel@x61.thuisdomein (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
PiBCdWlsZGluZyBjbWEubyB0cmlnZ2VycyB0aGlzIEdDQyB3YXJuaW5nOg0KPiAgICAgZHJpdmVy cy9pbmZpbmliYW5kL2NvcmUvY21hLmM6IEluIGZ1bmN0aW9uIOKAmHJkbWFfcmVzb2x2ZV9hZGRy 4oCZOg0KPiAgICAgZHJpdmVycy9pbmZpbmliYW5kL2NvcmUvY21hLmM6NDY1OjIzOiB3YXJuaW5n OiDigJhwb3J04oCZIG1heSBiZSB1c2VkDQo+IHVuaW5pdGlhbGl6ZWQgaW4gdGhpcyBmdW5jdGlv biBbLVdtYXliZS11bmluaXRpYWxpemVkXQ0KPiAgICAgZHJpdmVycy9pbmZpbmliYW5kL2NvcmUv Y21hLmM6NDI2OjU6IG5vdGU6IOKAmHBvcnTigJkgd2FzIGRlY2xhcmVkIGhlcmUNCj4gDQo+IFRo aXMgaXMgYSBmYWxzZSBwb3NpdGl2ZSwgYXMgInBvcnQiIHdpbGwgYWx3YXlzIGJlIGluaXRpYWxp emVkIGlmIHdlJ3JlDQo+IGF0ICJmb3VuZCIuIEJ1dCBpZiB3ZSBhc3NpZ24gdG8gImlkX3ByaXYt PmlkLnBvcnRfbnVtIiBkaXJlY3RseSwgd2UgY2FuDQo+IGRyb3AgInBvcnQiLiBUaGF0IHdpbGws IG9idmlvdXNseSwgc2lsZW5jZSBHQ0MuDQo+IA0KPiBTaWduZWQtb2ZmLWJ5OiBQYXVsIEJvbGxl IDxwZWJvbGxlQHRpc2NhbGkubmw+DQoNCkFja2VkLWJ5OiBTZWFuIEhlZnR5IDxzZWFuLmhlZnR5 QGludGVsLmNvbT4NCg0KPiAtLS0NCj4gMCkgdjI6IGFzc2lnbiB0byAiaWRfcHJpdi0+aWQucG9y dF9udW0iIGRpcmVjdGx5LCBpbnN0ZWFkIG9mDQo+IGluaXRpYWxpemluZyAicG9ydCIgdG8gMCwg YXMgZGlzY3Vzc2VkIHdpdGggU2Vhbi4NCj4gDQo+IDEpIFN0aWxsIG9ubHkgY29tcGlsZSB0ZXN0 ZWQuDQoNCnRlc3RlZCAtIHRoYW5rcw0K -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index f1c279f..84487a2 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -423,7 +423,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) struct sockaddr_ib *addr; union ib_gid gid, sgid, *dgid; u16 pkey, index; - u8 port, p; + u8 p; int i; cma_dev = NULL; @@ -443,7 +443,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) if (!memcmp(&gid, dgid, sizeof(gid))) { cma_dev = cur_dev; sgid = gid; - port = p; + id_priv->id.port_num = p; goto found; } @@ -451,7 +451,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) dgid->global.subnet_prefix)) { cma_dev = cur_dev; sgid = gid; - port = p; + id_priv->id.port_num = p; } } } @@ -462,7 +462,6 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) found: cma_attach_to_dev(id_priv, cma_dev); - id_priv->id.port_num = port; addr = (struct sockaddr_ib *) cma_src_addr(id_priv); memcpy(&addr->sib_addr, &sgid, sizeof sgid); cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
Building cma.o triggers this GCC warning: drivers/infiniband/core/cma.c: In function ‘rdma_resolve_addr’: drivers/infiniband/core/cma.c:465:23: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/infiniband/core/cma.c:426:5: note: ‘port’ was declared here This is a false positive, as "port" will always be initialized if we're at "found". But if we assign to "id_priv->id.port_num" directly, we can drop "port". That will, obviously, silence GCC. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> --- 0) v2: assign to "id_priv->id.port_num" directly, instead of initializing "port" to 0, as discussed with Sean. 1) Still only compile tested. drivers/infiniband/core/cma.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)