* [PATCH v1 0/2] sprd drm cover letter @ 2021-12-24 14:12 ` Kevin Tang 0 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: kevin3.tang, pony1.wu, orsonzhai, dan.carpenter, zou_wei, lukas.bulwahn, zhang.lyra, linux-kernel, dri-devel, devicetree v1: remove the selected DRM_KMS_CMA_HELPER in kconfig drm-sprd-fix-potential-NULL-dereference Kevin Tang (2): drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig drm/sprd: fix potential NULL dereference drivers/gpu/drm/sprd/Kconfig | 1 - drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ 4 files changed, 8 insertions(+), 7 deletions(-) -- 2.29.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v1 0/2] sprd drm cover letter @ 2021-12-24 14:12 ` Kevin Tang 0 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, kevin3.tang, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter v1: remove the selected DRM_KMS_CMA_HELPER in kconfig drm-sprd-fix-potential-NULL-dereference Kevin Tang (2): drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig drm/sprd: fix potential NULL dereference drivers/gpu/drm/sprd/Kconfig | 1 - drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ 4 files changed, 8 insertions(+), 7 deletions(-) -- 2.29.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig 2021-12-24 14:12 ` Kevin Tang @ 2021-12-24 14:12 ` Kevin Tang -1 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: kevin3.tang, pony1.wu, orsonzhai, dan.carpenter, zou_wei, lukas.bulwahn, zhang.lyra, linux-kernel, dri-devel, devicetree On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, which selects DRM_KMS_CMA_HELPER. However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> --- drivers/gpu/drm/sprd/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig index 3edeaeca0..9a9c7ebfc 100644 --- a/drivers/gpu/drm/sprd/Kconfig +++ b/drivers/gpu/drm/sprd/Kconfig @@ -3,7 +3,6 @@ config DRM_SPRD depends on ARCH_SPRD || COMPILE_TEST depends on DRM && OF select DRM_GEM_CMA_HELPER - select DRM_KMS_CMA_HELPER select DRM_KMS_HELPER select DRM_MIPI_DSI select VIDEOMODE_HELPERS -- 2.29.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig @ 2021-12-24 14:12 ` Kevin Tang 0 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, kevin3.tang, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, which selects DRM_KMS_CMA_HELPER. However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> --- drivers/gpu/drm/sprd/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig index 3edeaeca0..9a9c7ebfc 100644 --- a/drivers/gpu/drm/sprd/Kconfig +++ b/drivers/gpu/drm/sprd/Kconfig @@ -3,7 +3,6 @@ config DRM_SPRD depends on ARCH_SPRD || COMPILE_TEST depends on DRM && OF select DRM_GEM_CMA_HELPER - select DRM_KMS_CMA_HELPER select DRM_KMS_HELPER select DRM_MIPI_DSI select VIDEOMODE_HELPERS -- 2.29.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig 2021-12-24 14:12 ` Kevin Tang @ 2022-01-11 9:11 ` Javier Martinez Canillas -1 siblings, 0 replies; 16+ messages in thread From: Javier Martinez Canillas @ 2022-01-11 9:11 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter Hello Kevin, On 12/24/21 15:12, Kevin Tang wrote: > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > According to "The canonical patch format" section in [0], the body of the explanation has to be line wrapped at 75 columns. But your sentences are much longer than that. [0]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- Other than that, the patch looks good to me. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig @ 2022-01-11 9:11 ` Javier Martinez Canillas 0 siblings, 0 replies; 16+ messages in thread From: Javier Martinez Canillas @ 2022-01-11 9:11 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, orsonzhai, lukas.bulwahn, zou_wei, pony1.wu, dan.carpenter Hello Kevin, On 12/24/21 15:12, Kevin Tang wrote: > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > According to "The canonical patch format" section in [0], the body of the explanation has to be line wrapped at 75 columns. But your sentences are much longer than that. [0]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- Other than that, the patch looks good to me. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig 2021-12-24 14:12 ` Kevin Tang @ 2022-01-11 9:20 ` Thomas Zimmermann -1 siblings, 0 replies; 16+ messages in thread From: Thomas Zimmermann @ 2022-01-11 9:20 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter [-- Attachment #1.1: Type: text/plain, Size: 1481 bytes --] Hi Am 24.12.21 um 15:12 schrieb Kevin Tang: > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. With the long lines fixed, you can add Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Selecting DRM_GEM_CMA_HELPER and DRM_KMS_HELPER at the same time acts like DRM_KMS_CMA_HELPER did before. Best regards Thomas > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig > index 3edeaeca0..9a9c7ebfc 100644 > --- a/drivers/gpu/drm/sprd/Kconfig > +++ b/drivers/gpu/drm/sprd/Kconfig > @@ -3,7 +3,6 @@ config DRM_SPRD > depends on ARCH_SPRD || COMPILE_TEST > depends on DRM && OF > select DRM_GEM_CMA_HELPER > - select DRM_KMS_CMA_HELPER > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select VIDEOMODE_HELPERS -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig @ 2022-01-11 9:20 ` Thomas Zimmermann 0 siblings, 0 replies; 16+ messages in thread From: Thomas Zimmermann @ 2022-01-11 9:20 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, orsonzhai, lukas.bulwahn, zou_wei, pony1.wu, dan.carpenter [-- Attachment #1.1: Type: text/plain, Size: 1481 bytes --] Hi Am 24.12.21 um 15:12 schrieb Kevin Tang: > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. With the long lines fixed, you can add Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Selecting DRM_GEM_CMA_HELPER and DRM_KMS_HELPER at the same time acts like DRM_KMS_CMA_HELPER did before. Best regards Thomas > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig > index 3edeaeca0..9a9c7ebfc 100644 > --- a/drivers/gpu/drm/sprd/Kconfig > +++ b/drivers/gpu/drm/sprd/Kconfig > @@ -3,7 +3,6 @@ config DRM_SPRD > depends on ARCH_SPRD || COMPILE_TEST > depends on DRM && OF > select DRM_GEM_CMA_HELPER > - select DRM_KMS_CMA_HELPER > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select VIDEOMODE_HELPERS -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig 2021-12-24 14:12 ` Kevin Tang @ 2022-01-11 9:24 ` Lukas Bulwahn -1 siblings, 0 replies; 16+ messages in thread From: Lukas Bulwahn @ 2022-01-11 9:24 UTC (permalink / raw) To: Kevin Tang Cc: Maarten Lankhorst, Maxime Ripard, sean, David Airlie, Daniel Vetter, Rob Herring, Mark Rutland, pony1.wu, Orson Zhai, Dan Carpenter, zou_wei, Chunyan Zhang, Linux Kernel Mailing List, dri-devel, devicetree On Fri, Dec 24, 2021 at 3:12 PM Kevin Tang <kevin3.tang@gmail.com> wrote: > > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > That this commit is _currently_ on linux-next is just a matter of the current state. The commit message that goes into the project's history should probably not state "on linux-next"; this information is probably outdated or of no interest to any further future reader at the time of reading. So, just drop "On linux-next". The commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") will exist until the end of time. > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. > I would be happy about acknowledging my work of reporting with a Reported-by tag, although I accidently send the report only to you without cc-ing the mailing lists. Please add: Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> That said you may also add a Reviewed-by tag now: Reviewed-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Lukas > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig > index 3edeaeca0..9a9c7ebfc 100644 > --- a/drivers/gpu/drm/sprd/Kconfig > +++ b/drivers/gpu/drm/sprd/Kconfig > @@ -3,7 +3,6 @@ config DRM_SPRD > depends on ARCH_SPRD || COMPILE_TEST > depends on DRM && OF > select DRM_GEM_CMA_HELPER > - select DRM_KMS_CMA_HELPER > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select VIDEOMODE_HELPERS > -- > 2.29.0 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig @ 2022-01-11 9:24 ` Lukas Bulwahn 0 siblings, 0 replies; 16+ messages in thread From: Lukas Bulwahn @ 2022-01-11 9:24 UTC (permalink / raw) To: Kevin Tang Cc: Mark Rutland, devicetree, David Airlie, pony1.wu, Linux Kernel Mailing List, Rob Herring, dri-devel, Chunyan Zhang, Orson Zhai, zou_wei, sean, Dan Carpenter On Fri, Dec 24, 2021 at 3:12 PM Kevin Tang <kevin3.tang@gmail.com> wrote: > > On linux-next, commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") adds the config DRM_SPRD, > which selects DRM_KMS_CMA_HELPER. > That this commit is _currently_ on linux-next is just a matter of the current state. The commit message that goes into the project's history should probably not state "on linux-next"; this information is probably outdated or of no interest to any further future reader at the time of reading. So, just drop "On linux-next". The commit 43531edd53f0 ("drm/sprd: add Unisoc's drm kms master") will exist until the end of time. > However, commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") just removed the > DRM_KMS_CMA_HELPER. So, the select DRM_KMS_CMA_HELPER refers to a non-existing kconfig symbol. > I would be happy about acknowledging my work of reporting with a Reported-by tag, although I accidently send the report only to you without cc-ing the mailing lists. Please add: Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> That said you may also add a Reviewed-by tag now: Reviewed-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Lukas > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig > index 3edeaeca0..9a9c7ebfc 100644 > --- a/drivers/gpu/drm/sprd/Kconfig > +++ b/drivers/gpu/drm/sprd/Kconfig > @@ -3,7 +3,6 @@ config DRM_SPRD > depends on ARCH_SPRD || COMPILE_TEST > depends on DRM && OF > select DRM_GEM_CMA_HELPER > - select DRM_KMS_CMA_HELPER > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select VIDEOMODE_HELPERS > -- > 2.29.0 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v1 2/2] drm/sprd: fix potential NULL dereference 2021-12-24 14:12 ` Kevin Tang @ 2021-12-24 14:12 ` Kevin Tang -1 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: kevin3.tang, pony1.wu, orsonzhai, dan.carpenter, zou_wei, lukas.bulwahn, zhang.lyra, linux-kernel, dri-devel, devicetree platform_get_resource() may fail and return NULL, so check it's value before using it. 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference it, remove this warning log. Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> --- drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c index 06a3414ee..69683b7ba 100644 --- a/drivers/gpu/drm/sprd/sprd_dpu.c +++ b/drivers/gpu/drm/sprd/sprd_dpu.c @@ -790,6 +790,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu, int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + ctx->base = devm_ioremap(dev, res->start, resource_size(res)); if (!ctx->base) { dev_err(dev, "failed to map dpu registers\n"); diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c index a077e2d4d..54030839e 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -154,12 +154,8 @@ static void sprd_drm_shutdown(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); - if (!drm) { - drm_warn(drm, "drm device is not available, no shutdown\n"); - return; - } - - drm_atomic_helper_shutdown(drm); + if (drm) + drm_atomic_helper_shutdown(drm); } static const struct of_device_id drm_match_table[] = { diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c index 911b3cddc..955c5995a 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -907,6 +907,9 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi, struct resource *res; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + ctx->base = devm_ioremap(dev, res->start, resource_size(res)); if (!ctx->base) { drm_err(dsi->drm, "failed to map dsi host registers\n"); -- 2.29.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v1 2/2] drm/sprd: fix potential NULL dereference @ 2021-12-24 14:12 ` Kevin Tang 0 siblings, 0 replies; 16+ messages in thread From: Kevin Tang @ 2021-12-24 14:12 UTC (permalink / raw) To: maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, kevin3.tang, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter platform_get_resource() may fail and return NULL, so check it's value before using it. 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference it, remove this warning log. Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> --- drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c index 06a3414ee..69683b7ba 100644 --- a/drivers/gpu/drm/sprd/sprd_dpu.c +++ b/drivers/gpu/drm/sprd/sprd_dpu.c @@ -790,6 +790,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu, int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + ctx->base = devm_ioremap(dev, res->start, resource_size(res)); if (!ctx->base) { dev_err(dev, "failed to map dpu registers\n"); diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c index a077e2d4d..54030839e 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -154,12 +154,8 @@ static void sprd_drm_shutdown(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); - if (!drm) { - drm_warn(drm, "drm device is not available, no shutdown\n"); - return; - } - - drm_atomic_helper_shutdown(drm); + if (drm) + drm_atomic_helper_shutdown(drm); } static const struct of_device_id drm_match_table[] = { diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c index 911b3cddc..955c5995a 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -907,6 +907,9 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi, struct resource *res; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + ctx->base = devm_ioremap(dev, res->start, resource_size(res)); if (!ctx->base) { drm_err(dsi->drm, "failed to map dsi host registers\n"); -- 2.29.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v1 2/2] drm/sprd: fix potential NULL dereference 2021-12-24 14:12 ` Kevin Tang @ 2022-01-11 9:18 ` Javier Martinez Canillas -1 siblings, 0 replies; 16+ messages in thread From: Javier Martinez Canillas @ 2022-01-11 9:18 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter On 12/24/21 15:12, Kevin Tang wrote: > platform_get_resource() may fail and return NULL, so check it's value > before using it. > > 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference > it, remove this warning log. > I would split this second change in a separate patch and just keep this one about checking the platform_get_resource() return value. If you do that, feel free to add: Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 2/2] drm/sprd: fix potential NULL dereference @ 2022-01-11 9:18 ` Javier Martinez Canillas 0 siblings, 0 replies; 16+ messages in thread From: Javier Martinez Canillas @ 2022-01-11 9:18 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, orsonzhai, lukas.bulwahn, zou_wei, pony1.wu, dan.carpenter On 12/24/21 15:12, Kevin Tang wrote: > platform_get_resource() may fail and return NULL, so check it's value > before using it. > > 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference > it, remove this warning log. > I would split this second change in a separate patch and just keep this one about checking the platform_get_resource() return value. If you do that, feel free to add: Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 2/2] drm/sprd: fix potential NULL dereference 2021-12-24 14:12 ` Kevin Tang @ 2022-01-11 9:31 ` Thomas Zimmermann -1 siblings, 0 replies; 16+ messages in thread From: Thomas Zimmermann @ 2022-01-11 9:31 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, lukas.bulwahn, orsonzhai, zou_wei, pony1.wu, dan.carpenter [-- Attachment #1.1: Type: text/plain, Size: 3133 bytes --] Hi, on the changes for platform_get_resource(), you can Acked-by: Thomas Zimmermann <tzimmermann@suse.de> but see my comments below. Am 24.12.21 um 15:12 schrieb Kevin Tang: > platform_get_resource() may fail and return NULL, so check it's value > before using it. > > 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference > it, remove this warning log. > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ > drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ > drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ > 3 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c > index 06a3414ee..69683b7ba 100644 > --- a/drivers/gpu/drm/sprd/sprd_dpu.c > +++ b/drivers/gpu/drm/sprd/sprd_dpu.c > @@ -790,6 +790,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu, > int ret; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) > + return -EINVAL; > + You can add an error message if this fails. > ctx->base = devm_ioremap(dev, res->start, resource_size(res)); > if (!ctx->base) { > dev_err(dev, "failed to map dpu registers\n"); > diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c > index a077e2d4d..54030839e 100644 > --- a/drivers/gpu/drm/sprd/sprd_drm.c > +++ b/drivers/gpu/drm/sprd/sprd_drm.c > @@ -154,12 +154,8 @@ static void sprd_drm_shutdown(struct platform_device *pdev) > { > struct drm_device *drm = platform_get_drvdata(pdev); > > - if (!drm) { > - drm_warn(drm, "drm device is not available, no shutdown\n"); > - return; > - } > - > - drm_atomic_helper_shutdown(drm); > + if (drm) > + drm_atomic_helper_shutdown(drm); This change should be in a separate patch. Instead of removing the warning, you should rather use dev_err() or dev_warn() from [1]. Not being able to shut down here looks like a serious driver bug that the user should know about. > } > > static const struct of_device_id drm_match_table[] = { > diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c > index 911b3cddc..955c5995a 100644 > --- a/drivers/gpu/drm/sprd/sprd_dsi.c > +++ b/drivers/gpu/drm/sprd/sprd_dsi.c > @@ -907,6 +907,9 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi, > struct resource *res; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) > + return -EINVAL; > + Again, an error message seems appropriate. Best regards Thomas [1] https://elixir.bootlin.com/linux/latest/source/include/linux/dev_printk.h#L145 > ctx->base = devm_ioremap(dev, res->start, resource_size(res)); > if (!ctx->base) { > drm_err(dsi->drm, "failed to map dsi host registers\n"); -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v1 2/2] drm/sprd: fix potential NULL dereference @ 2022-01-11 9:31 ` Thomas Zimmermann 0 siblings, 0 replies; 16+ messages in thread From: Thomas Zimmermann @ 2022-01-11 9:31 UTC (permalink / raw) To: Kevin Tang, maarten.lankhorst, mripard, sean, airlied, daniel, robh+dt, mark.rutland Cc: devicetree, zhang.lyra, linux-kernel, dri-devel, orsonzhai, lukas.bulwahn, zou_wei, pony1.wu, dan.carpenter [-- Attachment #1.1: Type: text/plain, Size: 3133 bytes --] Hi, on the changes for platform_get_resource(), you can Acked-by: Thomas Zimmermann <tzimmermann@suse.de> but see my comments below. Am 24.12.21 um 15:12 schrieb Kevin Tang: > platform_get_resource() may fail and return NULL, so check it's value > before using it. > > 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference > it, remove this warning log. > > Cc: Orson Zhai <orsonzhai@gmail.com> > Cc: Chunyan Zhang <zhang.lyra@gmail.com> > Signed-off-by: Kevin Tang <kevin.tang@unisoc.com> > --- > drivers/gpu/drm/sprd/sprd_dpu.c | 3 +++ > drivers/gpu/drm/sprd/sprd_drm.c | 8 ++------ > drivers/gpu/drm/sprd/sprd_dsi.c | 3 +++ > 3 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c > index 06a3414ee..69683b7ba 100644 > --- a/drivers/gpu/drm/sprd/sprd_dpu.c > +++ b/drivers/gpu/drm/sprd/sprd_dpu.c > @@ -790,6 +790,9 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu, > int ret; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) > + return -EINVAL; > + You can add an error message if this fails. > ctx->base = devm_ioremap(dev, res->start, resource_size(res)); > if (!ctx->base) { > dev_err(dev, "failed to map dpu registers\n"); > diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c > index a077e2d4d..54030839e 100644 > --- a/drivers/gpu/drm/sprd/sprd_drm.c > +++ b/drivers/gpu/drm/sprd/sprd_drm.c > @@ -154,12 +154,8 @@ static void sprd_drm_shutdown(struct platform_device *pdev) > { > struct drm_device *drm = platform_get_drvdata(pdev); > > - if (!drm) { > - drm_warn(drm, "drm device is not available, no shutdown\n"); > - return; > - } > - > - drm_atomic_helper_shutdown(drm); > + if (drm) > + drm_atomic_helper_shutdown(drm); This change should be in a separate patch. Instead of removing the warning, you should rather use dev_err() or dev_warn() from [1]. Not being able to shut down here looks like a serious driver bug that the user should know about. > } > > static const struct of_device_id drm_match_table[] = { > diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c > index 911b3cddc..955c5995a 100644 > --- a/drivers/gpu/drm/sprd/sprd_dsi.c > +++ b/drivers/gpu/drm/sprd/sprd_dsi.c > @@ -907,6 +907,9 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi, > struct resource *res; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) > + return -EINVAL; > + Again, an error message seems appropriate. Best regards Thomas [1] https://elixir.bootlin.com/linux/latest/source/include/linux/dev_printk.h#L145 > ctx->base = devm_ioremap(dev, res->start, resource_size(res)); > if (!ctx->base) { > drm_err(dsi->drm, "failed to map dsi host registers\n"); -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-01-11 9:31 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-12-24 14:12 [PATCH v1 0/2] sprd drm cover letter Kevin Tang 2021-12-24 14:12 ` Kevin Tang 2021-12-24 14:12 ` [PATCH v1 1/2] drm/sprd: remove the selected DRM_KMS_CMA_HELPER in kconfig Kevin Tang 2021-12-24 14:12 ` Kevin Tang 2022-01-11 9:11 ` Javier Martinez Canillas 2022-01-11 9:11 ` Javier Martinez Canillas 2022-01-11 9:20 ` Thomas Zimmermann 2022-01-11 9:20 ` Thomas Zimmermann 2022-01-11 9:24 ` Lukas Bulwahn 2022-01-11 9:24 ` Lukas Bulwahn 2021-12-24 14:12 ` [PATCH v1 2/2] drm/sprd: fix potential NULL dereference Kevin Tang 2021-12-24 14:12 ` Kevin Tang 2022-01-11 9:18 ` Javier Martinez Canillas 2022-01-11 9:18 ` Javier Martinez Canillas 2022-01-11 9:31 ` Thomas Zimmermann 2022-01-11 9:31 ` Thomas Zimmermann
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.