On 03/01/2016 09:04 PM, Christoph Hellwig wrote:
> 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.
>
Better to be same than sorry; some overly clever code analysis tool
might trip over it otherwise.
> Otherwise this looks fine to me.
Reviewed-by: ?
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
[email protected] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
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