diff mbox series

[v3] drm/mediatek: fix uninitialized symbol

Message ID 20230803094843.4439-1-nancy.lin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [v3] drm/mediatek: fix uninitialized symbol | expand

Commit Message

Nancy Lin (林欣螢) Aug. 3, 2023, 9:48 a.m. UTC
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")
Signed-off-by: Nancy.Lin <nancy.lin@mediatek.com>
---
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(-)

Comments

Hari Prasath Gujulan Elango Aug. 3, 2023, 10:15 a.m. UTC | #1
On 03/08/23 3:18 pm, Nancy.Lin wrote:
> [You don't often get email from nancy.lin@mediatek.com. 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")
> Signed-off-by: Nancy.Lin <nancy.lin@mediatek.com>
> ---
> 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(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index f114da4d36a9..771f4e173353 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -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 ||

Is this also a related change ?

>              type == MTK_DISP_PWM ||
>              type == MTK_DISP_RDMA ||
>              type == MTK_DPI ||
> --
> 2.18.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Nancy Lin (林欣螢) Aug. 4, 2023, 2:04 a.m. UTC | #2
Hi Hari,

Thanks for the review.

On Thu, 2023-08-03 at 10:15 +0000, Hari.PrasathGE@microchip.com wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 03/08/23 3:18 pm, Nancy.Lin wrote:
> > [You don't often get email from nancy.lin@mediatek.com. 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")
> > Signed-off-by: Nancy.Lin <nancy.lin@mediatek.com>
> > ---
> > 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(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > index f114da4d36a9..771f4e173353 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > @@ -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 ||
> 
> 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

> >              type == MTK_DISP_PWM ||
> >              type == MTK_DISP_RDMA ||
> >              type == MTK_DPI ||
> > --
> > 2.18.0
> > 
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
>
Hari Prasath Gujulan Elango Aug. 4, 2023, 5:17 a.m. UTC | #3
On 04/08/23 7:34 am, Nancy Lin (林欣螢) wrote:
> [You don't often get email from nancy.lin@mediatek.com. 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 :)

> On Thu, 2023-08-03 at 10:15 +0000, Hari.PrasathGE@microchip.com wrote:
>>
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>   On 03/08/23 3:18 pm, Nancy.Lin wrote:
>>> [You don't often get email from nancy.lin@mediatek.com. 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")
>>> Signed-off-by: Nancy.Lin <nancy.lin@mediatek.com>
>>> ---
>>> 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(-)
>>>
>>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>>> index f114da4d36a9..771f4e173353 100644
>>> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
>>> @@ -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 ||
>>
>> 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
> 

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

>>>               type == MTK_DISP_PWM ||
>>>               type == MTK_DISP_RDMA ||
>>>               type == MTK_DPI ||
>>> --
>>> 2.18.0
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index f114da4d36a9..771f4e173353 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -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 ||