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.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html