Skip to content

Commit 572eaeb

Browse files
andy-shevJiri Kosina
authored andcommitted
HID: i2c-hid: acpi: Drop unneded NULL check of adev
The driver is enumerated on ACPI platforms, so adev is valid. Since there is no valid I²C ID table provided, there is no possibility to bind a device to this driver via user space. Hence, drop unneeded NULL check of adev. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f639e0b commit 572eaeb

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/hid/i2c-hid/i2c-hid-acpi.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ static guid_t i2c_hid_guid =
4848
GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
4949
0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
5050

51-
static int i2c_hid_acpi_get_descriptor(struct acpi_device *adev)
51+
static int i2c_hid_acpi_get_descriptor(struct i2c_hid_acpi *ihid_acpi)
5252
{
53+
struct acpi_device *adev = ihid_acpi->adev;
5354
acpi_handle handle = acpi_device_handle(adev);
5455
union acpi_object *obj;
5556
u16 hid_descriptor_address;
@@ -81,29 +82,22 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
8182
{
8283
struct device *dev = &client->dev;
8384
struct i2c_hid_acpi *ihid_acpi;
84-
struct acpi_device *adev;
8585
u16 hid_descriptor_address;
8686
int ret;
8787

88-
adev = ACPI_COMPANION(dev);
89-
if (!adev) {
90-
dev_err(&client->dev, "Error could not get ACPI device\n");
91-
return -ENODEV;
92-
}
93-
9488
ihid_acpi = devm_kzalloc(&client->dev, sizeof(*ihid_acpi), GFP_KERNEL);
9589
if (!ihid_acpi)
9690
return -ENOMEM;
9791

98-
ihid_acpi->adev = adev;
92+
ihid_acpi->adev = ACPI_COMPANION(dev);
9993
ihid_acpi->ops.shutdown_tail = i2c_hid_acpi_shutdown_tail;
10094

101-
ret = i2c_hid_acpi_get_descriptor(adev);
95+
ret = i2c_hid_acpi_get_descriptor(ihid_acpi);
10296
if (ret < 0)
10397
return ret;
10498
hid_descriptor_address = ret;
10599

106-
acpi_device_fix_up_power(adev);
100+
acpi_device_fix_up_power(ihid_acpi->adev);
107101

108102
return i2c_hid_core_probe(client, &ihid_acpi->ops,
109103
hid_descriptor_address, 0);

0 commit comments

Comments
 (0)