* Re: [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr()
2016-11-17 11:00 [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr() Dan Carpenter
@ 2016-11-17 11:49 ` Leon Romanovsky
2016-11-17 12:16 ` Yuval Shaia
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2016-11-17 11:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Moni Shoua, Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
On Thu, Nov 17, 2016 at 02:00:05PM +0300, Dan Carpenter wrote:
> It makes me nervous when we cast pointer parameters. I would estimate
> that around 50% of the time, it indicates a bug. Here the cast is not
> needed becaue u32 and and unsigned int are the same thing. Removing the
> cast makes the code more robust and future proof in case any of the
> types change.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rxe/rxe_srq.c
> index 2a6e3cd..efc832a 100644
> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
> @@ -169,7 +169,7 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
> }
> }
>
> - err = rxe_queue_resize(q, (unsigned int *)&attr->max_wr,
> + err = rxe_queue_resize(q, &attr->max_wr,
> rcv_wqe_size(srq->rq.max_sge),
> srq->rq.queue->ip ?
> srq->rq.queue->ip->context :
> --
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr()
2016-11-17 11:00 [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr() Dan Carpenter
2016-11-17 11:49 ` Leon Romanovsky
@ 2016-11-17 12:16 ` Yuval Shaia
[not found] ` <20161117121554.GA4292-Hxa29pjIrETlQW142y8m19+IiqhCXseY@public.gmane.org>
2016-11-17 13:51 ` Moni Shoua
2016-12-12 21:37 ` Doug Ledford
3 siblings, 1 reply; 6+ messages in thread
From: Yuval Shaia @ 2016-11-17 12:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Moni Shoua, Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
Besides the soft-aggressive commit message -:)
Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
On Thu, Nov 17, 2016 at 02:00:05PM +0300, Dan Carpenter wrote:
> It makes me nervous when we cast pointer parameters. I would estimate
> that around 50% of the time, it indicates a bug. Here the cast is not
> needed becaue u32 and and unsigned int are the same thing. Removing the
> cast makes the code more robust and future proof in case any of the
> types change.
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rxe/rxe_srq.c
> index 2a6e3cd..efc832a 100644
> --- a/drivers/infiniband/sw/rxe/rxe_srq.c
> +++ b/drivers/infiniband/sw/rxe/rxe_srq.c
> @@ -169,7 +169,7 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
> }
> }
>
> - err = rxe_queue_resize(q, (unsigned int *)&attr->max_wr,
> + err = rxe_queue_resize(q, &attr->max_wr,
> rcv_wqe_size(srq->rq.max_sge),
> srq->rq.queue->ip ?
> srq->rq.queue->ip->context :
> --
> 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
--
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] 6+ messages in thread* Re: [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr()
2016-11-17 11:00 [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr() Dan Carpenter
2016-11-17 11:49 ` Leon Romanovsky
2016-11-17 12:16 ` Yuval Shaia
@ 2016-11-17 13:51 ` Moni Shoua
2016-12-12 21:37 ` Doug Ledford
3 siblings, 0 replies; 6+ messages in thread
From: Moni Shoua @ 2016-11-17 13:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
kernel-janitors
On Thu, Nov 17, 2016 at 1:00 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> It makes me nervous when we cast pointer parameters. I would estimate
> that around 50% of the time, it indicates a bug. Here the cast is not
> needed becaue u32 and and unsigned int are the same thing. Removing the
> cast makes the code more robust and future proof in case any of the
> types change.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Moni Shoua <monis@mellanox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr()
2016-11-17 11:00 [patch] IB/rxe: Remove unneeded cast in rxe_srq_from_attr() Dan Carpenter
` (2 preceding siblings ...)
2016-11-17 13:51 ` Moni Shoua
@ 2016-12-12 21:37 ` Doug Ledford
3 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2016-12-12 21:37 UTC (permalink / raw)
To: Dan Carpenter, Moni Shoua
Cc: Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors
[-- Attachment #1.1: Type: text/plain, Size: 511 bytes --]
On 11/17/2016 6:00 AM, Dan Carpenter wrote:
> It makes me nervous when we cast pointer parameters. I would estimate
> that around 50% of the time, it indicates a bug. Here the cast is not
> needed becaue u32 and and unsigned int are the same thing. Removing the
> cast makes the code more robust and future proof in case any of the
> types change.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied.
--
Doug Ledford <dledford@redhat.com>
GPG Key ID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread