All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] i2c: acpi: Drop double check for ACPI companion device
@ 2020-05-28 14:18 Andy Shevchenko
  2020-05-28 16:02 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-05-28 14:18 UTC (permalink / raw)
  To: Mika Westerberg, linux-i2c, Wolfram Sang, linux-acpi; +Cc: Andy Shevchenko

acpi_dev_get_resources() does perform the NULL pointer check against
ACPI companion device which is given as function parameter. Thus,
there is no need to duplicate this check in the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/i2c-core-acpi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index c8f42f2037cb..2ade99b105b9 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -468,16 +468,12 @@ struct notifier_block i2c_acpi_notifier = {
 struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
 				       struct i2c_board_info *info)
 {
+	struct acpi_device *adev = ACPI_COMPANION(dev);
 	struct i2c_acpi_lookup lookup;
 	struct i2c_adapter *adapter;
-	struct acpi_device *adev;
 	LIST_HEAD(resource_list);
 	int ret;
 
-	adev = ACPI_COMPANION(dev);
-	if (!adev)
-		return ERR_PTR(-EINVAL);
-
 	memset(&lookup, 0, sizeof(lookup));
 	lookup.info = info;
 	lookup.device_handle = acpi_device_handle(adev);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] i2c: acpi: Drop double check for ACPI companion device
  2020-05-28 14:18 [PATCH v1] i2c: acpi: Drop double check for ACPI companion device Andy Shevchenko
@ 2020-05-28 16:02 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2020-05-28 16:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Mika Westerberg, linux-i2c, linux-acpi

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

On Thu, May 28, 2020 at 05:18:58PM +0300, Andy Shevchenko wrote:
> acpi_dev_get_resources() does perform the NULL pointer check against
> ACPI companion device which is given as function parameter. Thus,
> there is no need to duplicate this check in the caller.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-28 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 14:18 [PATCH v1] i2c: acpi: Drop double check for ACPI companion device Andy Shevchenko
2020-05-28 16:02 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.