lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7P1c4kZ3r2NrV6+@kuha.fi.intel.com>
Date:   Tue, 3 Jan 2023 11:29:23 +0200
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1 2/2] usb: typec: intel_pmc_mux: Deduplicate ACPI
 matching in probe

On Mon, Jan 02, 2023 at 10:29:33PM +0200, Andy Shevchenko wrote:
> There is no need to call acpi_dev_present() followed by
> acpi_dev_get_first_match_dev() as they both do the same
> with only difference in the returning value. Instead,
> call the latter and check its result.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  drivers/usb/typec/mux/intel_pmc_mux.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index 87e2c9130607..34e4188a40ff 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -602,16 +602,15 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)
>  	int ret;
>  
>  	for (dev_id = &iom_acpi_ids[0]; dev_id->id[0]; dev_id++) {
> -		if (acpi_dev_present(dev_id->id, NULL, -1)) {
> -			pmc->iom_port_status_offset = (u32)dev_id->driver_data;
> -			adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1);
> +		adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1);
> +		if (adev)
>  			break;
> -		}
>  	}
> -
>  	if (!adev)
>  		return -ENODEV;
>  
> +	pmc->iom_port_status_offset = (u32)dev_id->driver_data;
> +
>  	INIT_LIST_HEAD(&resource_list);
>  	ret = acpi_dev_get_memory_resources(adev, &resource_list);
>  	if (ret < 0) {
> -- 
> 2.35.1

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ