Re: [PATCH] char: tpm: cr50_i2c: Drop if with an always false condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 26, 2022 at 07:35:29AM +0300, Jarkko Sakkinen wrote:

> Even if chip is expected not to be NULL, a sanity check costs nothing.
> As already said, this should be reviewed in the context of the callback
> change.
> 
> Even then, the change should rather be:
> 
>        if (!chip) {
>                dev_err(dev, "Could not get client data at remove\n");
>                return;
>        } 

If it can't happen by design it should be deleted entirely, or be
turned into a WARN_ON:

if (WARN_ON(!chip))
   return;

But I find this largely unnecessary as a null chip will reliably oops
later on in the same function.

Jason



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux