Commit 5a652fe5 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

misc: microchip: pci1xxxx: Fix some NULL vs IS_ERR() bugs



The devm_nvmem_register() function returns error pointers.  It never
returns NULL.  Update the checks accordingly.

Fixes: 09690015 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/043df330-222b-4c2c-ae19-ed2f731bfe0b@moroto.mountain


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1314e122
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -379,8 +379,8 @@ static int pci1xxxx_otp_eeprom_probe(struct auxiliary_device *aux_dev,

		priv->nvmem_eeprom = devm_nvmem_register(&aux_dev->dev,
							 &priv->nvmem_config_eeprom);
		if (!priv->nvmem_eeprom)
			return -ENOMEM;
		if (IS_ERR(priv->nvmem_eeprom))
			return PTR_ERR(priv->nvmem_eeprom);
	}

	release_sys_lock(priv);
@@ -398,8 +398,8 @@ static int pci1xxxx_otp_eeprom_probe(struct auxiliary_device *aux_dev,

	priv->nvmem_otp = devm_nvmem_register(&aux_dev->dev,
					      &priv->nvmem_config_otp);
	if (!priv->nvmem_otp)
		return -ENOMEM;
	if (IS_ERR(priv->nvmem_otp))
		return PTR_ERR(priv->nvmem_otp);

	return ret;
}