W1: abort search early on on exit
authorDavid Fries <david@fries.net>
Thu, 16 Oct 2008 05:04:39 +0000 (22:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 18:21:49 +0000 (11:21 -0700)
Early abort if the master driver or the hardware goes away in the middle
of a bus search operation.  The alternative is to spam the print buffer up
to 64*64 times with read errors in the case of USB.

Signed-off-by: David Fries <david@fries.net>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/w1/w1.c

index 25640f6817292d080e6a53d346ff07a1c18dc77d..aac03f151fe0e0999f2bf582081f6d91f453d631 100644 (file)
@@ -772,6 +772,11 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
                        /* extract the direction taken & update the device number */
                        tmp64 = (triplet_ret >> 2);
                        rn |= (tmp64 << i);
+
+                       if (test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
+                               printk(KERN_INFO "Abort w1_search (exiting)\n");
+                               return;
+                       }
                }
 
                if ( (triplet_ret & 0x03) != 0x03 ) {