Re: [PATCH][RESEND] scsi_sysfs: add 'is_bin_visible' callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux