diff mbox

infiniband: remove redundant assignment to pointer 'rdi'

Message ID 20180301162354.17420-1-colin.king@canonical.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Colin King March 1, 2018, 4:23 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The pointer rdi is being initialized with a value that is never read
and re-assigned immediately after, hence the initialization is redundant
and can be removed.

Cleans up clang warning:
drivers/infiniband/sw/rdmavt/vt.c:94:23: warning: Value stored to 'rdi'
during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/sw/rdmavt/vt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hiatt, Don March 1, 2018, 5:47 p.m. UTC | #1
On 3/1/2018 8:23 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer rdi is being initialized with a value that is never read
> and re-assigned immediately after, hence the initialization is redundant
> and can be removed.
>
> Cleans up clang warning:
> drivers/infiniband/sw/rdmavt/vt.c:94:23: warning: Value stored to 'rdi'
> during its initialization is never read
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/infiniband/sw/rdmavt/vt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
> index a4553b2b3696..a67b0ddc2230 100644
> --- a/drivers/infiniband/sw/rdmavt/vt.c
> +++ b/drivers/infiniband/sw/rdmavt/vt.c
> @@ -91,7 +91,7 @@ module_exit(rvt_cleanup);
>    */
>   struct rvt_dev_info *rvt_alloc_device(size_t size, int nports)
>   {
> -	struct rvt_dev_info *rdi = ERR_PTR(-ENOMEM);
> +	struct rvt_dev_info *rdi;
>   
>   	rdi = (struct rvt_dev_info *)ib_alloc_device(size);
>   	if (!rdi)
Thanks: Reviewed-by: Don Hiatt <don.hiatt@intel.com>

--
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
Jason Gunthorpe March 6, 2018, 11:34 p.m. UTC | #2
On Thu, Mar 01, 2018 at 04:23:54PM +0000, Colin Ian King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer rdi is being initialized with a value that is never read
> and re-assigned immediately after, hence the initialization is redundant
> and can be removed.
> 
> Cleans up clang warning:
> drivers/infiniband/sw/rdmavt/vt.c:94:23: warning: Value stored to 'rdi'
> during its initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>  drivers/infiniband/sw/rdmavt/vt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to for-next, thanks

Jason
--
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 mbox

Patch

diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index a4553b2b3696..a67b0ddc2230 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -91,7 +91,7 @@  module_exit(rvt_cleanup);
  */
 struct rvt_dev_info *rvt_alloc_device(size_t size, int nports)
 {
-	struct rvt_dev_info *rdi = ERR_PTR(-ENOMEM);
+	struct rvt_dev_info *rdi;
 
 	rdi = (struct rvt_dev_info *)ib_alloc_device(size);
 	if (!rdi)