eeprom: ee1004: Check chip before probing
authorEddie James <eajames@linux.ibm.com>
Tue, 18 Feb 2025 22:09:59 +0000 (16:09 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Feb 2025 14:25:18 +0000 (15:25 +0100)
Like other eeprom drivers, check if the device is really there and
functional before probing.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20250218220959.721698-1-eajames@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/eeprom/ee1004.c

index 89224d4af4a201b0e6b7a4437cc90eb95c6e7b11..e13f9fdd9d7b1c79af0ab67d129ca90054bc8e5e 100644 (file)
@@ -304,6 +304,10 @@ static int ee1004_probe(struct i2c_client *client)
                                     I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_READ_BYTE_DATA))
                return -EPFNOSUPPORT;
 
+       err = i2c_smbus_read_byte(client);
+       if (err < 0)
+               return -ENODEV;
+
        mutex_lock(&ee1004_bus_lock);
 
        err = ee1004_init_bus_data(client);