blk_probe_dev() only reads the major_names[] hash chain. Traverse it with a struct blk_major_name pointer instead of a pointer to the previous next pointer, as blkdev_show() already does. This change prepares for annotating major_names[] with __guarded_by(): Clang's context analysis verifies reads of major_names[] but does not yet check accesses through a pointer obtained with &major_names[index]. No functional change is intended. Signed-off-by: Bart Van Assche --- block/genhd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 251a5b07baff..647765449670 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -884,12 +884,12 @@ static ssize_t disk_badblocks_store(struct device *dev, static bool blk_probe_dev(dev_t devt) { unsigned int major = MAJOR(devt); - struct blk_major_name **n; + struct blk_major_name *p; mutex_lock(&major_names_lock); - for (n = &major_names[major_to_index(major)]; *n; n = &(*n)->next) { - if ((*n)->major == major && (*n)->probe) { - (*n)->probe(devt); + for (p = major_names[major_to_index(major)]; p; p = p->next) { + if (p->major == major && p->probe) { + p->probe(devt); mutex_unlock(&major_names_lock); return true; }