linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Ewan Milne <emilne@redhat.com>,
	Bart van Assche <bart.vanassche@sandisk.com>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH][RESEND] scsi_sysfs: add 'is_bin_visible' callback
Date: Tue, 1 Mar 2016 14:04:48 +0100	[thread overview]
Message-ID: <20160301130448.GB7616@lst.de> (raw)
In-Reply-To: <1456807945-88857-1-git-send-email-hare@suse.de>

On Tue, Mar 01, 2016 at 05:52:25AM +0100, Hannes Reinecke wrote:
> +	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct scsi_device *sdev = to_scsi_device(dev);
> +
> +
> +	rcu_read_lock();
> +	if (attr == &dev_attr_vpd_pg80 &&
> +	    !rcu_dereference(sdev->vpd_pg80)) {
> +		rcu_read_unlock();
> +		return 0;
> +	}
> +	if (attr == &dev_attr_vpd_pg83 &&
> +	    !rcu_dereference(sdev->vpd_pg83)) {
> +		rcu_read_unlock();
> +		return 0;
> +	}
> +	rcu_read_unlock();

We are only checking the pointers for being non-zero.  No need for the
rcu_read_lock() or rcu_dereference() here.

Otherwise this looks fine to me.

  parent reply	other threads:[~2016-03-01 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01  4:52 [PATCH][RESEND] scsi_sysfs: add 'is_bin_visible' callback Hannes Reinecke
2016-03-01  6:45 ` Seymour, Shane M
2016-03-01  9:08 ` Johannes Thumshirn
2016-03-01 13:04 ` Christoph Hellwig [this message]
2016-03-02  7:33   ` Hannes Reinecke
2016-03-02  9:19     ` Christoph Hellwig
2016-03-02  9:34       ` Hannes Reinecke

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=20160301130448.GB7616@lst.de \
    --to=hch@lst.de \
    --cc=bart.vanassche@sandisk.com \
    --cc=emilne@redhat.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).