2023-11-30 07:26:51

by Dan Carpenter

[permalink] [raw]
Subject: [PATCH 1/2] drm/imagination: Fix error codes in pvr_device_clk_init()

There is a cut and paste error so this code returns the wrong variable.

Fixes: 1f88f017e649 ("drm/imagination: Get GPU resources")
Signed-off-by: Dan Carpenter <[email protected]>
---
drivers/gpu/drm/imagination/pvr_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
index 8499becf4fbb..e1dcc4e42087 100644
--- a/drivers/gpu/drm/imagination/pvr_device.c
+++ b/drivers/gpu/drm/imagination/pvr_device.c
@@ -105,12 +105,12 @@ static int pvr_device_clk_init(struct pvr_device *pvr_dev)

sys_clk = devm_clk_get_optional(drm_dev->dev, "sys");
if (IS_ERR(sys_clk))
- return dev_err_probe(drm_dev->dev, PTR_ERR(core_clk),
+ return dev_err_probe(drm_dev->dev, PTR_ERR(sys_clk),
"failed to get sys clock\n");

mem_clk = devm_clk_get_optional(drm_dev->dev, "mem");
if (IS_ERR(mem_clk))
- return dev_err_probe(drm_dev->dev, PTR_ERR(core_clk),
+ return dev_err_probe(drm_dev->dev, PTR_ERR(mem_clk),
"failed to get mem clock\n");

pvr_dev->core_clk = core_clk;
--
2.42.0


2023-11-30 07:27:22

by Dan Carpenter

[permalink] [raw]
Subject: [PATCH 2/2] drm/imagination: Fix IS_ERR() vs NULL bug in pvr_request_firmware()

The pvr_build_firmware_filename() function returns NULL on error. It
doesn't return error pointers.

Fixes: f99f5f3ea7ef ("drm/imagination: Add GPU ID parsing and firmware loading")
Signed-off-by: Dan Carpenter <[email protected]>
---
drivers/gpu/drm/imagination/pvr_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
index e1dcc4e42087..5389aea7ff21 100644
--- a/drivers/gpu/drm/imagination/pvr_device.c
+++ b/drivers/gpu/drm/imagination/pvr_device.c
@@ -286,8 +286,8 @@ pvr_request_firmware(struct pvr_device *pvr_dev)

filename = pvr_build_firmware_filename(pvr_dev, "powervr/rogue",
PVR_FW_VERSION_MAJOR);
- if (IS_ERR(filename))
- return PTR_ERR(filename);
+ if (!filename)
+ return -ENOMEM;

/*
* This function takes a copy of &filename, meaning we can free our
--
2.42.0

2023-11-30 09:10:01

by Frank Binns

[permalink] [raw]
Subject: Re: [PATCH 2/2] drm/imagination: Fix IS_ERR() vs NULL bug in pvr_request_firmware()

On Thu, 2023-11-30 at 10:27 +0300, Dan Carpenter wrote:
> The pvr_build_firmware_filename() function returns NULL on error. It
> doesn't return error pointers.
>
> Fixes: f99f5f3ea7ef ("drm/imagination: Add GPU ID parsing and firmware loading")
> Signed-off-by: Dan Carpenter <[email protected]>

Reviewed-by: Frank Binns <[email protected]>

> ---
> drivers/gpu/drm/imagination/pvr_device.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
> index e1dcc4e42087..5389aea7ff21 100644
> --- a/drivers/gpu/drm/imagination/pvr_device.c
> +++ b/drivers/gpu/drm/imagination/pvr_device.c
> @@ -286,8 +286,8 @@ pvr_request_firmware(struct pvr_device *pvr_dev)
>
> filename = pvr_build_firmware_filename(pvr_dev, "powervr/rogue",
> PVR_FW_VERSION_MAJOR);
> - if (IS_ERR(filename))
> - return PTR_ERR(filename);
> + if (!filename)
> + return -ENOMEM;
>
> /*
> * This function takes a copy of &filename, meaning we can free our

2023-11-30 09:10:03

by Frank Binns

[permalink] [raw]
Subject: Re: [PATCH 1/2] drm/imagination: Fix error codes in pvr_device_clk_init()

Hi,

Thank you for the patches.

On Thu, 2023-11-30 at 10:26 +0300, Dan Carpenter wrote:
> There is a cut and paste error so this code returns the wrong variable.
>
> Fixes: 1f88f017e649 ("drm/imagination: Get GPU resources")
> Signed-off-by: Dan Carpenter <[email protected]>

Reviewed-by: Frank Binns <[email protected]>

> ---
> drivers/gpu/drm/imagination/pvr_device.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
> index 8499becf4fbb..e1dcc4e42087 100644
> --- a/drivers/gpu/drm/imagination/pvr_device.c
> +++ b/drivers/gpu/drm/imagination/pvr_device.c
> @@ -105,12 +105,12 @@ static int pvr_device_clk_init(struct pvr_device *pvr_dev)
>
> sys_clk = devm_clk_get_optional(drm_dev->dev, "sys");
> if (IS_ERR(sys_clk))
> - return dev_err_probe(drm_dev->dev, PTR_ERR(core_clk),
> + return dev_err_probe(drm_dev->dev, PTR_ERR(sys_clk),
> "failed to get sys clock\n");
>
> mem_clk = devm_clk_get_optional(drm_dev->dev, "mem");
> if (IS_ERR(mem_clk))
> - return dev_err_probe(drm_dev->dev, PTR_ERR(core_clk),
> + return dev_err_probe(drm_dev->dev, PTR_ERR(mem_clk),
> "failed to get mem clock\n");
>
> pvr_dev->core_clk = core_clk;

2023-11-30 09:18:59

by Maxime Ripard

[permalink] [raw]
Subject: Re: (subset) [PATCH 2/2] drm/imagination: Fix IS_ERR() vs NULL bug in pvr_request_firmware()

On Thu, 30 Nov 2023 10:27:01 +0300, Dan Carpenter wrote:
> The pvr_build_firmware_filename() function returns NULL on error. It
> doesn't return error pointers.
>
>

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime

2023-11-30 09:19:00

by Maxime Ripard

[permalink] [raw]
Subject: Re: (subset) [PATCH 1/2] drm/imagination: Fix error codes in pvr_device_clk_init()

On Thu, 30 Nov 2023 10:26:29 +0300, Dan Carpenter wrote:
> There is a cut and paste error so this code returns the wrong variable.
>
>

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime