* [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers
[not found] <20250407134753.985925-1-tzimmermann@suse.de>
@ 2025-04-07 13:47 ` Thomas Zimmermann
2025-04-07 13:58 ` Javier Martinez Canillas
2025-04-07 13:59 ` Jocelyn Falempe
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2025-04-07 13:47 UTC (permalink / raw)
To: javierm, jfalempe; +Cc: dri-devel, Thomas Zimmermann, stable
The res pointer passed to simpledrm_device_release_clocks() and
simpledrm_device_release_regulators() points to an instance of
struct simpledrm_device. No need to upcast from struct drm_device.
The upcast is harmless, as DRM device is the first field in struct
simpledrm_device.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
Cc: <stable@vger.kernel.org> # v5.14+
---
drivers/gpu/drm/sysfb/simpledrm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index cfb1fe07704d7..78672422bcada 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -275,7 +275,7 @@ static struct simpledrm_device *simpledrm_device_of_dev(struct drm_device *dev)
static void simpledrm_device_release_clocks(void *res)
{
- struct simpledrm_device *sdev = simpledrm_device_of_dev(res);
+ struct simpledrm_device *sdev = res;
unsigned int i;
for (i = 0; i < sdev->clk_count; ++i) {
@@ -373,7 +373,7 @@ static int simpledrm_device_init_clocks(struct simpledrm_device *sdev)
static void simpledrm_device_release_regulators(void *res)
{
- struct simpledrm_device *sdev = simpledrm_device_of_dev(res);
+ struct simpledrm_device *sdev = res;
unsigned int i;
for (i = 0; i < sdev->regulator_count; ++i) {
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers
2025-04-07 13:47 ` [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers Thomas Zimmermann
@ 2025-04-07 13:58 ` Javier Martinez Canillas
2025-04-07 13:59 ` Jocelyn Falempe
1 sibling, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2025-04-07 13:58 UTC (permalink / raw)
To: Thomas Zimmermann, jfalempe; +Cc: dri-devel, Thomas Zimmermann, stable
Thomas Zimmermann <tzimmermann@suse.de> writes:
> The res pointer passed to simpledrm_device_release_clocks() and
> simpledrm_device_release_regulators() points to an instance of
> struct simpledrm_device. No need to upcast from struct drm_device.
> The upcast is harmless, as DRM device is the first field in struct
> simpledrm_device.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
> Cc: <stable@vger.kernel.org> # v5.14+
> ---
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers
2025-04-07 13:47 ` [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers Thomas Zimmermann
2025-04-07 13:58 ` Javier Martinez Canillas
@ 2025-04-07 13:59 ` Jocelyn Falempe
1 sibling, 0 replies; 3+ messages in thread
From: Jocelyn Falempe @ 2025-04-07 13:59 UTC (permalink / raw)
To: Thomas Zimmermann, javierm; +Cc: dri-devel, stable
On 07/04/2025 15:47, Thomas Zimmermann wrote:
> The res pointer passed to simpledrm_device_release_clocks() and
> simpledrm_device_release_regulators() points to an instance of
> struct simpledrm_device. No need to upcast from struct drm_device.
> The upcast is harmless, as DRM device is the first field in struct
> simpledrm_device.
>
Thanks, it looks good to me.
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
> Cc: <stable@vger.kernel.org> # v5.14+
> ---
> drivers/gpu/drm/sysfb/simpledrm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
> index cfb1fe07704d7..78672422bcada 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
> @@ -275,7 +275,7 @@ static struct simpledrm_device *simpledrm_device_of_dev(struct drm_device *dev)
>
> static void simpledrm_device_release_clocks(void *res)
> {
> - struct simpledrm_device *sdev = simpledrm_device_of_dev(res);
> + struct simpledrm_device *sdev = res;
> unsigned int i;
>
> for (i = 0; i < sdev->clk_count; ++i) {
> @@ -373,7 +373,7 @@ static int simpledrm_device_init_clocks(struct simpledrm_device *sdev)
>
> static void simpledrm_device_release_regulators(void *res)
> {
> - struct simpledrm_device *sdev = simpledrm_device_of_dev(res);
> + struct simpledrm_device *sdev = res;
> unsigned int i;
>
> for (i = 0; i < sdev->regulator_count; ++i) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-07 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250407134753.985925-1-tzimmermann@suse.de>
2025-04-07 13:47 ` [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers Thomas Zimmermann
2025-04-07 13:58 ` Javier Martinez Canillas
2025-04-07 13:59 ` Jocelyn Falempe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox