On Fri, 2021-11-12 at 23:53 +0100, Uwe Kleine-König wrote: > tpm_cr50_i2c_remove() is only called after tpm_cr50_i2c_probe() returned > successfully. As i2c_get_clientdata() returns driver data for the > client's device and this was set in tpmm_chip_alloc() it won't return > NULL. This does not make the check obsolete, e.g. it would catch a programming error elsewhere. > Simplify accordingly to prepare changing the prototype of the i2c remove > callback to return void. Notice that already today returning an error > code from the remove callback doesn't prevent removal. I don't understand what you are trying to say. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > --- > drivers/char/tpm/tpm_tis_i2c_cr50.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c > index c89278103703..622cdf622ddc 100644 > --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c > +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c > @@ -751,12 +751,6 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client) > static int tpm_cr50_i2c_remove(struct i2c_client *client) > { > struct tpm_chip *chip = i2c_get_clientdata(client); > - struct device *dev = &client->dev; > - > - if (!chip) { > - dev_err(dev, "Could not get client data at remove\n"); > - return -ENODEV; > - } > > tpm_chip_unregister(chip); > tpm_cr50_release_locality(chip, true); /Jarkko