From patchwork Sat Mar 22 20:38:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Monam Agarwal X-Patchwork-Id: 3878021 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C30DBBF540 for ; Sat, 22 Mar 2014 20:39:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E088D20204 for ; Sat, 22 Mar 2014 20:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22EBE20200 for ; Sat, 22 Mar 2014 20:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751240AbaCVUjA (ORCPT ); Sat, 22 Mar 2014 16:39:00 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:53495 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbaCVUjA (ORCPT ); Sat, 22 Mar 2014 16:39:00 -0400 Received: by mail-pa0-f44.google.com with SMTP id bj1so3805719pad.31 for ; Sat, 22 Mar 2014 13:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=Fjrg/C/+NM1RVdm2zkbRDfbiJIt2X+qS37moNrEfGOQ=; b=K8ZB60Qs341Wf9PVGN+a3EiOI/RzAKgLh2oO0dMcPfM6xWLFkpKbwOfzarCq9qIvzh bRgtUGG+M3JK37sZ2cqGCf8tbuB0bYQXLWyx1boBbUQztq+zdlSnyyLgpEebhhokQY3H OEIGKo/kOfYFECzPCqppAbe5OAgAjchkC9q3lpeTKoWBkzjrJjjlBIt5paf6vpQ35m7Z NFsKduDMhw+Vgao+nPV4WMp1nV4y00fA2ivFbJw0CtA7pUG1hCW7fSgfc9kqi4YZB9Jr tvq0boAFuIs/TFJPA5YsHMYymVmG4lMrA9Phm9biqDkP+rEouNvNjA5Y5N5d52kLwEjP I2TA== X-Received: by 10.69.31.43 with SMTP id kj11mr60370395pbd.67.1395520739707; Sat, 22 Mar 2014 13:38:59 -0700 (PDT) Received: from hacker.iiit.ac.in ([14.139.82.6]) by mx.google.com with ESMTPSA id oz7sm17307080pbc.41.2014.03.22.13.38.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Mar 2014 13:38:58 -0700 (PDT) From: Monam Agarwal To: infinipath@intel.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/infiniband: Use RCU_INIT_POINTER(x, NULL) in hw/qib/qib_qp.c Date: Sun, 23 Mar 2014 02:08:00 +0530 Message-Id: <1395520680-3459-1-git-send-email-monamagarwal123@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) The rcu_assign_pointer() ensures that the initialization of a structure is carried out before storing a pointer to that structure. And in the case of the NULL pointer, there is no structure to initialize. So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL) Signed-off-by: Monam Agarwal Acked-by: Mike Marciniszyn --- drivers/infiniband/hw/qib/qib_qp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 0cad0c4..04c8b74 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c @@ -255,10 +255,10 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp) if (rcu_dereference_protected(ibp->qp0, lockdep_is_held(&dev->qpt_lock)) == qp) { - rcu_assign_pointer(ibp->qp0, NULL); + RCU_INIT_POINTER(ibp->qp0, NULL); } else if (rcu_dereference_protected(ibp->qp1, lockdep_is_held(&dev->qpt_lock)) == qp) { - rcu_assign_pointer(ibp->qp1, NULL); + RCU_INIT_POINTER(ibp->qp1, NULL); } else { struct qib_qp *q; struct qib_qp __rcu **qpp; @@ -315,7 +315,7 @@ unsigned qib_free_all_qps(struct qib_devdata *dd) for (n = 0; n < dev->qp_table_size; n++) { qp = rcu_dereference_protected(dev->qp_table[n], lockdep_is_held(&dev->qpt_lock)); - rcu_assign_pointer(dev->qp_table[n], NULL); + RCU_INIT_POINTER(dev->qp_table[n], NULL); for (; qp; qp = rcu_dereference_protected(qp->next, lockdep_is_held(&dev->qpt_lock)))