diff mbox series

[v2,09/15] media: ipu-bridge: Drop early setting of sensor->adev

Message ID 20230630110643.209761-10-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series media: ipu-bridge: Shared with atomisp, rework VCM instantiation | expand

Commit Message

Hans de Goede June 30, 2023, 11:06 a.m. UTC
sensor->adev is no longer dereferenced before it is permanently set by:

	sensor->adev = acpi_dev_get(adev);

So the early assignment with a borrowed reference can be dropped.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/pci/intel/ipu-bridge.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Andy Shevchenko June 30, 2023, 2:30 p.m. UTC | #1
On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> sensor->adev is no longer dereferenced before it is permanently set by:
>
>         sensor->adev = acpi_dev_get(adev);
>
> So the early assignment with a borrowed reference can be dropped.

Ah, now I see that that change was temporary. Can we avoid backporting
it please?
Hans de Goede July 4, 2023, 11:20 a.m. UTC | #2
Hi,

On 6/30/23 16:30, Andy Shevchenko wrote:
> On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> sensor->adev is no longer dereferenced before it is permanently set by:
>>
>>         sensor->adev = acpi_dev_get(adev);
>>
>> So the early assignment with a borrowed reference can be dropped.
> 
> Ah, now I see that that change was temporary.

Ack

> Can we avoid backporting
> it please?

Patch 1/15 does fix a NULL pointer deref oops, so backporting it would
be a good thing to do IMHO.

Regards,

Hans
Andy Shevchenko July 4, 2023, 2:26 p.m. UTC | #3
On Tue, Jul 04, 2023 at 01:20:33PM +0200, Hans de Goede wrote:
> On 6/30/23 16:30, Andy Shevchenko wrote:
> > On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@redhat.com> wrote:
> >>
> >> sensor->adev is no longer dereferenced before it is permanently set by:
> >>
> >>         sensor->adev = acpi_dev_get(adev);
> >>
> >> So the early assignment with a borrowed reference can be dropped.
> > 
> > Ah, now I see that that change was temporary.
> 
> Ack
> 
> > Can we avoid backporting
> > it please?
> 
> Patch 1/15 does fix a NULL pointer deref oops, so backporting it would
> be a good thing to do IMHO.

Then better to go with ACPI handle. I don't like the rewriting same field
(even if it's the same information). It's prone to errors which might be
hard to find.
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index daa9dde78c64..891dc0b7c960 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -342,11 +342,6 @@  static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 		}
 
 		sensor = &bridge->sensors[bridge->n_sensors];
-		/*
-		 * Borrow our adev ref to the sensor for now, on success
-		 * acpi_dev_get(adev) is done further below.
-		 */
-		sensor->adev = adev;
 
 		ret = ipu_bridge_parse_ssdb(adev, sensor);
 		if (ret)