]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/spi/spidev.c
spi: avoid spidev crash when device is removed
[linux-2.6-omap-h63xx.git] / drivers / spi / spidev.c
index 89a43755a453bb265ebfa789adca222a8cce1ebe..5d869c4d3eb2a2e3dd9f46ae3ebf1cfbd333e61f 100644 (file)
@@ -597,7 +597,9 @@ static int spidev_probe(struct spi_device *spi)
        }
        mutex_unlock(&device_list_lock);
 
-       if (status != 0)
+       if (status == 0)
+               spi_set_drvdata(spi, spidev);
+       else
                kfree(spidev);
 
        return status;