From: Dan Carpenter Date: Mon, 13 Jan 2025 06:15:41 +0000 (+0300) Subject: HID: intel-thc-hid: intel-thc: Fix error code in thc_i2c_subip_init() X-Git-Tag: v6.14-rc1~145^2~5^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b0d62fa73f22884e1ddd4ed6e288f959ad116ae;p=thirdparty%2Fkernel%2Flinux.git HID: intel-thc-hid: intel-thc: Fix error code in thc_i2c_subip_init() Return -ENOMEM if the allocation fails. Don't return success. Fixes: 4228966def88 ("HID: intel-thc-hid: intel-thc: Add THC I2C config interfaces") Signed-off-by: Dan Carpenter Link: https://patch.msgid.link/eb4ea363-c3b7-4988-9ff5-5ed74bf47620@stanley.mountain Signed-off-by: Benjamin Tissoires --- diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c index 92a1dbe9a9283..4fc78b5a04b5f 100644 --- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c @@ -1519,7 +1519,7 @@ int thc_i2c_subip_init(struct thc_device *dev, const u32 target_address, dev->i2c_subip_regs = devm_kzalloc(dev->dev, sizeof(i2c_subip_regs), GFP_KERNEL); if (!dev->i2c_subip_regs) - return PTR_ERR(dev->i2c_subip_regs); + return -ENOMEM; return 0; }