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] [day] [month] [year] [list]
Message-ID: <CAAObsKDqv6Df15xrPpNYe3QP5AcwATM5EwpX4Ny7HSYNwAUpZQ@mail.gmail.com>
Date: Sat, 10 Jan 2026 17:55:10 +0100
From: Tomeu Vizoso <tomeu@...euvizoso.net>
To: Quentin Schulz <foss+kernel@...il.net>
Cc: Oded Gabbay <ogabbay@...nel.org>, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org, linux-rockchip@...ts.infradead.org, 
	Quentin Schulz <quentin.schulz@...rry.de>
Subject: Re: [PATCH] accel/rocket: factor out code with find_core_for_dev in rocket_remove

On Mon, Dec 15, 2025 at 6:07 PM Quentin Schulz <foss+kernel@...il.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@...rry.de>
>
> There already is a function to return the offset of the core for a given
> struct device, so let's reuse that function instead of reimplementing
> the same logic.
>
> There's one change in behavior when a struct device is passed which
> doesn't match any core's. Before, we would continue through
> rocket_remove() but now we exit early, to match what other callers of
> find_core_for_dev() (rocket_device_runtime_resume/suspend()) are doing.
> This however should never happen. Aside from that, no intended change in
> behavior.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@...rry.de>

Thank you, pushed it to drm-misc-next.

Best regards,

Tomeu Vizoso

> ---
>  drivers/accel/rocket/rocket_drv.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/accel/rocket/rocket_drv.c b/drivers/accel/rocket/rocket_drv.c
> index 5c0b63f0a8f00..28bf6c602f802 100644
> --- a/drivers/accel/rocket/rocket_drv.c
> +++ b/drivers/accel/rocket/rocket_drv.c
> @@ -180,17 +180,18 @@ static int rocket_probe(struct platform_device *pdev)
>         return rocket_core_init(&rdev->cores[core]);
>  }
>
> +static int find_core_for_dev(struct device *dev);
> +
>  static void rocket_remove(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
> +       int core = find_core_for_dev(dev);
>
> -       for (unsigned int core = 0; core < rdev->num_cores; core++) {
> -               if (rdev->cores[core].dev == dev) {
> -                       rocket_core_fini(&rdev->cores[core]);
> -                       rdev->num_cores--;
> -                       break;
> -               }
> -       }
> +       if (core < 0)
> +               return;
> +
> +       rocket_core_fini(&rdev->cores[core]);
> +       rdev->num_cores--;
>
>         if (rdev->num_cores == 0) {
>                 /* Last core removed, deinitialize DRM device. */
>
> ---
> base-commit: a619746d25c8adafe294777cc98c47a09759b3ed
> change-id: 20251215-rocket-reuse-find-core-8ecb7ed24cab
>
> Best regards,
> --
> Quentin Schulz <quentin.schulz@...rry.de>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ