Message ID | eb4ea363-c3b7-4988-9ff5-5ed74bf47620@stanley.mountain (mailing list archive) |
---|---|
State | New |
Delegated to: | Jiri Kosina |
Headers | show |
Series | [next] HID: intel-thc-hid: intel-thc: Fix error code in thc_i2c_subip_init() | expand |
> -----Original Message----- > From: Dan Carpenter <dan.carpenter@linaro.org> > Sent: Monday, January 13, 2025 2:16 PM > To: Xu, Even <even.xu@intel.com> > Cc: Sun, Xinpeng <xinpeng.sun@intel.com>; Jiri Kosina <jikos@kernel.org>; > Benjamin Tissoires <bentiss@kernel.org>; Mark Pearson <mpearson- > lenovo@squebb.ca>; Srinivas Pandruvada > <srinivas.pandruvada@linux.intel.com>; linux-input@vger.kernel.org; linux- > kernel@vger.kernel.org; kernel-janitors@vger.kernel.org > Subject: [PATCH next] 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 <dan.carpenter@linaro.org> > --- > drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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 92a1dbe9a928..4fc78b5a04b5 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; > Looks reasonable. Thanks Dan! Best Regards, Even Xu > return 0; > } > -- > 2.45.2
On Mon, 13 Jan 2025 09:15:41 +0300, Dan Carpenter wrote: > Return -ENOMEM if the allocation fails. Don't return success. > > Applied to hid/hid.git (for-6.14/intel-thc), thanks! [1/1] HID: intel-thc-hid: intel-thc: Fix error code in thc_i2c_subip_init() https://git.kernel.org/hid/hid/c/0b0d62fa73f2 Cheers,
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 92a1dbe9a928..4fc78b5a04b5 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; }
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 <dan.carpenter@linaro.org> --- drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)