From: David Fries Date: Thu, 16 Oct 2008 05:04:39 +0000 (-0700) Subject: W1: abort search early on on exit X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0d671b272af9eb06260ab3fd210d454e98dd4216;p=linux-beck.git W1: abort search early on on exit 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 Signed-off-by: Evgeniy Polyakov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 25640f681729..aac03f151fe0 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -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 ) {