Skip to contentSkip to conversation

drm/mediatek: fix uninitialized symbol

PATCH In review Nancy.Lin 2 participants 4 messages Aug 3, 2023 – Aug 4, 2023

Subsystems (3)
lore
Share & tools
lore

Nancy.Lin

author
#0 lore raw

PATCH v3 1/1 drm/mediatek: fix uninitialized symbol

fix Smatch static checker warning
-Fix uninitialized symbol comp_pdev in mtk_ddp_comp_init.

Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")

---
v3: fix reviewer comment in v2
v2: add Fixes tag

---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +8 -8
index f114da4d36a9..771f4e173353 100644
@@ -563,14 +563,15 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	/* Not all drm components have a DTS device node, such as ovl_adaptor,
 	 * which is the drm bring up sub driver
 	 */
-	if (node) {
-		comp_pdev = of_find_device_by_node(node);
-		if (!comp_pdev) {
-			DRM_INFO("Waiting for device %s\n", node->full_name);
-			return -EPROBE_DEFER;
-		}
-		comp->dev = &comp_pdev->dev;
+	if (!node)
+		return 0;
+
+	comp_pdev = of_find_device_by_node(node);
+	if (!comp_pdev) {
+		DRM_INFO("Waiting for device %s\n", node->full_name);
+		return -EPROBE_DEFER;
 	}
+	comp->dev = &comp_pdev->dev;
 
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
@@ -580,7 +581,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	    type == MTK_DISP_MERGE ||
 	    type == MTK_DISP_OVL ||
 	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_OVL_ADAPTOR ||
 	    type == MTK_DISP_PWM ||
 	    type == MTK_DISP_RDMA ||
 	    type == MTK_DPI ||
Signature · 1 line
2.18.0
#1 lore raw
Quoted 44 lines · Nancy.Lin

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

fix Smatch static checker warning
-Fix uninitialized symbol comp_pdev in mtk_ddp_comp_init.

Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")

---
v3: fix reviewer comment in v2
v2: add Fixes tag

---
  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +8 -7
index f114da4d36a9..771f4e173353 100644
@@ -563,14 +563,15 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
         /* Not all drm components have a DTS device node, such as ovl_adaptor,
          * which is the drm bring up sub driver
          */
-       if (node) {
-               comp_pdev = of_find_device_by_node(node);
-               if (!comp_pdev) {
-                       DRM_INFO("Waiting for device %s\n", node->full_name);
-                       return -EPROBE_DEFER;
-               }
-               comp->dev = &comp_pdev->dev;
+       if (!node)
+               return 0;
+
+       comp_pdev = of_find_device_by_node(node);
+       if (!comp_pdev) {
+               DRM_INFO("Waiting for device %s\n", node->full_name);
+               return -EPROBE_DEFER;
         }
+       comp->dev = &comp_pdev->dev;
 
         if (type == MTK_DISP_AAL ||
             type == MTK_DISP_BLS ||

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp, · line 583

Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
@@ -580,7 +581,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
             type == MTK_DISP_MERGE ||
             type == MTK_DISP_OVL ||
             type == MTK_DISP_OVL_2L ||
-           type == MTK_DISP_OVL_ADAPTOR ||

Is this also a related change ?

Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
             type == MTK_DISP_PWM ||
             type == MTK_DISP_RDMA ||
             type == MTK_DPI ||
--

2.18.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi Hari,

Thanks for the review.

Quoted 57 lines · On Thu, 2023-08-03 at 10:15 +0000, [email protected] wrote:

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 1 line · Nancy.Lin

[You don't often get email from [email protected]. Learn why

this is important at https://aka.ms/LearnAboutSenderIdentification ]

Quoted 2 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you

know the content is safe

Quoted 5 lines

fix Smatch static checker warning
-Fix uninitialized symbol comp_pdev in mtk_ddp_comp_init.

Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver

for MT8195")

Review

Quoted 9 lines

---
v3: fix reviewer comment in v2
v2: add Fixes tag

---
  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node

Quoted 4 lines

index f114da4d36a9..771f4e173353 100644

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
@@ -563,14 +563,15 @@ int mtk_ddp_comp_init(struct device_node

*node, struct mtk_ddp_comp *comp,

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node · line 563

Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
         /* Not all drm components have a DTS device node, such as

ovl_adaptor,

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node *node,

Quoted 24 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +8 -7
          * which is the drm bring up sub driver
          */
-       if (node) {
-               comp_pdev = of_find_device_by_node(node);
-               if (!comp_pdev) {
-                       DRM_INFO("Waiting for device %s\n", node-
 full_name);
-                       return -EPROBE_DEFER;
-               }
-               comp->dev = &comp_pdev->dev;
+       if (!node)
+               return 0;
+
+       comp_pdev = of_find_device_by_node(node);
+       if (!comp_pdev) {
+               DRM_INFO("Waiting for device %s\n", node-
 full_name);
+               return -EPROBE_DEFER;
         }
+       comp->dev = &comp_pdev->dev;
 
         if (type == MTK_DISP_AAL ||
             type == MTK_DISP_BLS ||
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
@@ -580,7 +581,6 @@ int mtk_ddp_comp_init(struct device_node *node,

struct mtk_ddp_comp *comp,

Quoted 7 lines

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp, · line 583

Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
             type == MTK_DISP_MERGE ||
             type == MTK_DISP_OVL ||
             type == MTK_DISP_OVL_2L ||
-           type == MTK_DISP_OVL_ADAPTOR ||

Is this also a related change ?

These are the relevant modifications. MTK_DISP_OVL_ADAPTOR type component is a sub-driver of DRM that does not have a DTS node. This modification will return when checking if node is NULL, which means the comp with MTK_DISP_OVL_ADAPTOR type will also return above. Therefore, the condition "type == MTK_DISP_OVL_ADAPTOR" is unnecessary here.

Regards,
Nancy

Quoted 13 lines
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
             type == MTK_DISP_PWM ||
             type == MTK_DISP_RDMA ||
             type == MTK_DPI ||
--

2.18.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 8 lines · Nancy Lin (林欣螢)

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Hari,

Thanks for the review.

you're welcome :)

Quoted 66 lines · On Thu, 2023-08-03 at 10:15 +0000, [email protected] wrote:
Quoted 57 lines

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 1 line · Nancy.Lin

[You don't often get email from [email protected]. Learn why

this is important at https://aka.ms/LearnAboutSenderIdentification ]

Quoted 2 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you

know the content is safe

Quoted 5 lines

fix Smatch static checker warning
-Fix uninitialized symbol comp_pdev in mtk_ddp_comp_init.

Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver

for MT8195")

Review

Quoted 9 lines

---
v3: fix reviewer comment in v2
v2: add Fixes tag

---
   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 16 ++++++++--------
   1 file changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node

Quoted 4 lines

index f114da4d36a9..771f4e173353 100644

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
@@ -563,14 +563,15 @@ int mtk_ddp_comp_init(struct device_node

*node, struct mtk_ddp_comp *comp,

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node · line 563

Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
          /* Not all drm components have a DTS device node, such as

ovl_adaptor,

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node *node,

Quoted 24 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +8 -7
           * which is the drm bring up sub driver
           */
-       if (node) {
-               comp_pdev = of_find_device_by_node(node);
-               if (!comp_pdev) {
-                       DRM_INFO("Waiting for device %s\n", node-
 full_name);
-                       return -EPROBE_DEFER;
-               }
-               comp->dev = &comp_pdev->dev;
+       if (!node)
+               return 0;
+
+       comp_pdev = of_find_device_by_node(node);
+       if (!comp_pdev) {
+               DRM_INFO("Waiting for device %s\n", node-
 full_name);
+               return -EPROBE_DEFER;
          }
+       comp->dev = &comp_pdev->dev;
 
          if (type == MTK_DISP_AAL ||
              type == MTK_DISP_BLS ||
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -0
@@ -580,7 +581,6 @@ int mtk_ddp_comp_init(struct device_node *node,

struct mtk_ddp_comp *comp,

Quoted 7 lines

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp, · line 583

Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
              type == MTK_DISP_MERGE ||
              type == MTK_DISP_OVL ||
              type == MTK_DISP_OVL_2L ||
-           type == MTK_DISP_OVL_ADAPTOR ||

Is this also a related change ?

Quoted 9 lines

These are the relevant modifications. MTK_DISP_OVL_ADAPTOR type component is a sub-driver of DRM that does not have a DTS node. This modification will return when checking if node is NULL, which means the comp with MTK_DISP_OVL_ADAPTOR type will also return above. Therefore, the condition "type == MTK_DISP_OVL_ADAPTOR" is unnecessary here.

Regards,
Nancy

Oh I didn't notice that it fixes a different commit(0d9eee9118b7) that you mentioned in your commit message. Thanks for the clarification.

Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0 -1
              type == MTK_DISP_PWM ||
              type == MTK_DISP_RDMA ||
              type == MTK_DPI ||
--

2.18.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel