* [PATCH rdma-next] IB/rxe: Simplify rxe_init_ports logic
@ 2016-07-05 16:10 Moni Shoua
[not found] ` <1467735023-21942-1-git-send-email-monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Moni Shoua @ 2016-07-05 16:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, matanb-VPRAkNaXOzVWk0Htik3J/w,
talal-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
majd-VPRAkNaXOzVWk0Htik3J/w, Leon Romanovsky
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Simplify rxe_init_ports and remove double free.
Fixes: 0784481b2f32 ('Add initialization for Soft RoCE driver, pools constants etc.')
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/rxe/rxe.c | 29 ++++++-----------------------
1 file changed, 6 insertions(+), 23 deletions(-)
diff --git a/drivers/infiniband/hw/rxe/rxe.c b/drivers/infiniband/hw/rxe/rxe.c
index 48c41e00..d49418b 100644
--- a/drivers/infiniband/hw/rxe/rxe.c
+++ b/drivers/infiniband/hw/rxe/rxe.c
@@ -165,42 +165,25 @@ static int rxe_init_port_param(struct rxe_port *port)
*/
static int rxe_init_ports(struct rxe_dev *rxe)
{
- int err;
- struct rxe_port *port;
-
- port = &rxe->port;
+ struct rxe_port *port = &rxe->port;
rxe_init_port_param(port);
- if (!port->attr.pkey_tbl_len) {
- err = -EINVAL;
- goto err1;
- }
+ if (!port->attr.pkey_tbl_len || !port->attr.gid_tbl_len)
+ return -EINVAL;
port->pkey_tbl = kcalloc(port->attr.pkey_tbl_len,
sizeof(*port->pkey_tbl), GFP_KERNEL);
- if (!port->pkey_tbl) {
- err = -ENOMEM;
- goto err1;
- }
- port->pkey_tbl[0] = 0xffff;
-
- if (!port->attr.gid_tbl_len) {
- kfree(port->pkey_tbl);
- err = -EINVAL;
- goto err1;
- }
+ if (!port->pkey_tbl)
+ return -ENOMEM;
+ port->pkey_tbl[0] = 0xffff;
port->port_guid = rxe->ifc_ops->port_guid(rxe);
spin_lock_init(&port->port_lock);
return 0;
-
-err1:
- kfree(port->pkey_tbl);
- return err;
}
/* init pools of managed objects */
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-next] IB/rxe: Simplify rxe_init_ports logic
[not found] ` <1467735023-21942-1-git-send-email-monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-07-05 21:53 ` Or Gerlitz
[not found] ` <CAJ3xEMjZT3BO4TzwNiGVrKrqyRsqjYnUraYZopw7L-k4+BUB8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Or Gerlitz @ 2016-07-05 21:53 UTC (permalink / raw)
To: Moni Shoua
Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Matan Barak,
talal-VPRAkNaXOzVWk0Htik3J/w, Leon Romanovsky, Majd Dibbiny,
Leon Romanovsky
On Tue, Jul 5, 2016 at 7:10 PM, Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> Simplify rxe_init_ports and remove double free.
>
> Fixes: 0784481b2f32 ('Add initialization for Soft RoCE driver, pools constants etc.')
same
> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-next] IB/rxe: Simplify rxe_init_ports logic
[not found] ` <CAJ3xEMjZT3BO4TzwNiGVrKrqyRsqjYnUraYZopw7L-k4+BUB8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-07-12 14:54 ` Doug Ledford
0 siblings, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2016-07-12 14:54 UTC (permalink / raw)
To: Or Gerlitz, Moni Shoua
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Matan Barak,
talal-VPRAkNaXOzVWk0Htik3J/w, Leon Romanovsky, Majd Dibbiny,
Leon Romanovsky
[-- Attachment #1.1: Type: text/plain, Size: 695 bytes --]
On 7/5/2016 5:53 PM, Or Gerlitz wrote:
> On Tue, Jul 5, 2016 at 7:10 PM, Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
>> From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>>
>> Simplify rxe_init_ports and remove double free.
>>
>> Fixes: 0784481b2f32 ('Add initialization for Soft RoCE driver, pools constants etc.')
>
> same
>
>> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Applied, and squashed into original patch.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG Key ID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-12 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-05 16:10 [PATCH rdma-next] IB/rxe: Simplify rxe_init_ports logic Moni Shoua
[not found] ` <1467735023-21942-1-git-send-email-monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-05 21:53 ` Or Gerlitz
[not found] ` <CAJ3xEMjZT3BO4TzwNiGVrKrqyRsqjYnUraYZopw7L-k4+BUB8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-12 14:54 ` Doug Ledford
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.