public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreea-Cristina Bernat <bernat.ada@gmail.com>
To: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
	navin.patidar@gmail.com, davem@davemloft.net,
	jasowang@redhat.com, stsp@users.sourceforge.net,
	dborkman@redhat.com, Jes.Sorensen@redhat.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: paulmck@linux.vnet.ibm.com
Subject: [PATCH] os_dep: Replace rcu_dereference() with rcu_access_pointer()
Date: Sun, 17 Aug 2014 16:39:16 +0300	[thread overview]
Message-ID: <20140817133916.GA12655@ada> (raw)

The "rcu_dereference()" call is used directly in a condition.
Since its return value is never dereferenced it is recommended to use
"rcu_access_pointer()" instead of "rcu_dereference()".
Therefore, this patch makes the replacement.

The following Coccinelle semantic patch was used:
@@
@@

(
 if(
 (<+...
- rcu_dereference
+ rcu_access_pointer
  (...)
  ...+>)) {...}
|
 while(
 (<+...
- rcu_dereference
+ rcu_access_pointer
  (...)
  ...+>)) {...}
)

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 0e0c32d..4bb76e5 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -1010,7 +1010,7 @@ void netdev_br_init(struct net_device *netdev)
 
 	rcu_read_lock();
 
-	if (rcu_dereference(adapter->pnetdev->rx_handler_data)) {
+	if (rcu_access_pointer(adapter->pnetdev->rx_handler_data)) {
 		struct net_device *br_netdev;
 		struct net *devnet = NULL;
 
-- 
1.9.1


             reply	other threads:[~2014-08-17 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 13:39 Andreea-Cristina Bernat [this message]
2014-08-30 21:04 ` [PATCH] os_dep: Replace rcu_dereference() with rcu_access_pointer() Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140817133916.GA12655@ada \
    --to=bernat.ada@gmail.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navin.patidar@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=stsp@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox