drm/sysfb: simpledrm: Fix device upcasts
Subsystems (4)
Thomas Zimmermann
maintainercover drm/sysfb: simpledrm: Fix device upcasts
Simpledrm contains invalid upcasts from struct drm_device. Remove upcasting.
Thomas Zimmermann (2):
drm/simpledrm: Do not upcast in release helpers drm/sysfb: simpledrm: Remove unused helper simpledrm_device_of_dev()
drivers/gpu/drm/sysfb/simpledrm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
2.49.0
Thomas Zimmermann
maintainerPATCH 1/2 drm/simpledrm: Do not upcast in release helpers
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.
--- drivers/gpu/drm/sysfb/simpledrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sysfb/simpledrm.c +2 -2
@@ -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) {
Signature · 1 line
2.49.0
Re: [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers
Quoted 10 lines · Thomas Zimmermann
The res pointer passed to
simpledrm_device_release_clocks()andsimpledrm_device_release_regulators()points to an instance of structsimpledrm_device. No need to upcast from structdrm_device. The upcast is harmless, as DRM device is the first field in structsimpledrm_device.Signed-off-by Thomas Zimmermann <[email protected]>Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Cc <[email protected]> # v5.14+---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 1/2] drm/simpledrm: Do not upcast in release helpers
In reply to Thomas ZimmermannQuoted 6 lines · Thomas Zimmermann
The res pointer passed to
simpledrm_device_release_clocks()andsimpledrm_device_release_regulators()points to an instance of structsimpledrm_device. No need to upcast from structdrm_device. The upcast is harmless, as DRM device is the first field in structsimpledrm_device.
Thanks, it looks good to me.
Quoted 29 lines
Signed-off-by Thomas Zimmermann <[email protected]>Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Cc <[email protected]> # v5.14+--- drivers/gpu/drm/sysfb/simpledrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/sysfb/simpledrm.c +2
-2@@ -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) {
Thomas Zimmermann
maintainerPATCH 2/2 drm/sysfb: simpledrm: Remove unused helper simpledrm_device_of_dev()
In reply to Thomas ZimmermannAfter moving most of the mode-setting pipeline into drm_sysfb_helper.c, simpledrm_device_of_dev() is no longer being used. Remove it.
--- drivers/gpu/drm/sysfb/simpledrm.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/sysfb/simpledrm.c +0 -5
@@ -244,11 +244,6 @@ struct simpledrm_device {struct drm_connector connector; }; -static struct simpledrm_device *simpledrm_device_of_dev (struct drm_device *dev) -{ - return container_of(to_drm_sysfb_device(dev), struct simpledrm_device, sysfb); -} -/* * Hardware */
Signature · 1 line
2.49.0
Re: [PATCH 2/2] drm/sysfb: simpledrm: Remove unused helper simpledrm_device_of_dev()
Quoted 8 lines · Thomas Zimmermann
After moving most of the mode-setting pipeline into
drm_sysfb_helper.c,simpledrm_device_of_dev()is no longer being used. Remove it.Signed-off-by Thomas Zimmermann <[email protected]>Reported-by Jocelyn Falempe <[email protected]>Fixes 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions")---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 2/2] drm/sysfb: simpledrm: Remove unused helper simpledrm_device_of_dev()
In reply to Thomas ZimmermannQuoted 3 lines · Thomas Zimmermann
After moving most of the mode-setting pipeline into
drm_sysfb_helper.c,simpledrm_device_of_dev()is no longer being used. Remove it.
Thanks, it looks good to me.
Quoted 24 lines
Signed-off-by Thomas Zimmermann <[email protected]>Reported-by Jocelyn Falempe <[email protected]>Fixes 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions")--- drivers/gpu/drm/sysfb/simpledrm.c | 5 ----- 1 file changed, 5 deletions(-)drivers/gpu/drm/sysfb/simpledrm.c +0
-5@@ -244,11 +244,6 @@ struct simpledrm_device {struct drm_connector connector; }; -static struct simpledrm_device *simpledrm_device_of_dev (struct drm_device *dev) -{ - return container_of(to_drm_sysfb_device(dev), struct simpledrm_device, sysfb); -} -/* * Hardware */