diff mbox series

[v2,1/1] drm/i915/dsi: Drop double check ACPI companion device for NULL

Message ID 20211222154033.6770-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/1] drm/i915/dsi: Drop double check ACPI companion device for NULL | expand

Commit Message

Andy Shevchenko Dec. 22, 2021, 3:40 p.m. UTC
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>
---
v2: used LIST_HEAD() (Ville), initialized lookup directly on stack (Ville)
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 28 +++++++-------------
 1 file changed, 10 insertions(+), 18 deletions(-)

Comments

Andy Shevchenko Dec. 22, 2021, 7:21 p.m. UTC | #1
On Wed, Dec 22, 2021 at 06:34:54PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [v2,1/1] drm/i915/dsi: Drop double check ACPI companion device for NULL
> URL   : https://patchwork.freedesktop.org/series/98304/
> State : failure

I couldn't see how even possibly to have any new regression with the change
provided. Can anybody assure me that it's my patch made all those breakages?
Jani Nikula Dec. 27, 2021, 10:57 a.m. UTC | #2
On Wed, 22 Dec 2021, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Wed, Dec 22, 2021 at 06:34:54PM -0000, Patchwork wrote:
>> == Series Details ==
>> 
>> Series: series starting with [v2,1/1] drm/i915/dsi: Drop double check ACPI companion device for NULL
>> URL   : https://patchwork.freedesktop.org/series/98304/
>> State : failure
>
> I couldn't see how even possibly to have any new regression with the change
> provided. Can anybody assure me that it's my patch made all those breakages?

False positive. Pushed to drm-intel-next, thanks for the patch.

BR,
Jani.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
index 0da91849efde..da0bd056f3d3 100644
--- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
@@ -426,24 +426,16 @@  static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
 				  const u16 slave_addr)
 {
 	struct drm_device *drm_dev = intel_dsi->base.base.dev;
-	struct device *dev = drm_dev->dev;
-	struct acpi_device *acpi_dev;
-	struct list_head resource_list;
-	struct i2c_adapter_lookup lookup;
-
-	acpi_dev = ACPI_COMPANION(dev);
-	if (acpi_dev) {
-		memset(&lookup, 0, sizeof(lookup));
-		lookup.slave_addr = slave_addr;
-		lookup.intel_dsi = intel_dsi;
-		lookup.dev_handle = acpi_device_handle(acpi_dev);
-
-		INIT_LIST_HEAD(&resource_list);
-		acpi_dev_get_resources(acpi_dev, &resource_list,
-				       i2c_adapter_lookup,
-				       &lookup);
-		acpi_dev_free_resource_list(&resource_list);
-	}
+	struct acpi_device *adev = ACPI_COMPANION(drm_dev->dev);
+	struct i2c_adapter_lookup lookup = {
+		.slave_addr = slave_addr,
+		.intel_dsi = intel_dsi,
+		.dev_handle = acpi_device_handle(adev),
+	};
+	LIST_HEAD(resource_list);
+
+	acpi_dev_get_resources(adev, &resource_list, i2c_adapter_lookup, &lookup);
+	acpi_dev_free_resource_list(&resource_list);
 }
 #else
 static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,