diff mbox series

[v7,06/13] media: mtk-mdp: Check return value of of_clk_get

Message ID 20200213201953.15268-7-matthias.bgg@kernel.org (mailing list archive)
State New, archived
Headers show
Series arm/arm64: mediatek: Fix mmsys device probing | expand

Commit Message

Matthias Brugger Feb. 13, 2020, 8:19 p.m. UTC
From: Matthias Brugger <mbrugger@suse.com>

Check the return value of of_clk_get and print an error
message if not EPROBE_DEFER.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>

---

Changes in v7:
- fix check of return value of of_clk_get
- fix identation

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hans Verkuil Feb. 24, 2020, 5:36 p.m. UTC | #1
Hi Matthias,

On 2/13/20 9:19 PM, matthias.bgg@kernel.org wrote:
> From: Matthias Brugger <mbrugger@suse.com>
> 
> Check the return value of of_clk_get and print an error
> message if not EPROBE_DEFER.
> 
> Signed-off-by: Matthias Brugger <mbrugger@suse.com>

This patch is independent from the remainder of this series, right?
It looks good to me, so is it OK if I merge this in the media subsystem?

Regards,

	Hans

> 
> ---
> 
> Changes in v7:
> - fix check of return value of of_clk_get
> - fix identation
> 
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
> index 0c4788af78dd..58abfbdfb82d 100644
> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
> @@ -110,6 +110,12 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
>  
>  	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
>  		comp->clk[i] = of_clk_get(node, i);
> +		if (IS_ERR(comp->clk[i])) {
> +			if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER)
> +				dev_err(dev, "Failed to get clock\n");
> +
> +			return PTR_ERR(comp->clk[i]);
> +		}
>  
>  		/* Only RDMA needs two clocks */
>  		if (comp->type != MTK_MDP_RDMA)
>
Matthias Brugger Feb. 24, 2020, 9:47 p.m. UTC | #2
On 24/02/2020 18:36, Hans Verkuil wrote:
> Hi Matthias,
> 
> On 2/13/20 9:19 PM, matthias.bgg@kernel.org wrote:
>> From: Matthias Brugger <mbrugger@suse.com>
>>
>> Check the return value of of_clk_get and print an error
>> message if not EPROBE_DEFER.
>>
>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
> 
> This patch is independent from the remainder of this series, right?
> It looks good to me, so is it OK if I merge this in the media subsystem?
> 

Yes it is independent. Please merge it to the media subsystem.

Thanks,
Matthias

> Regards,
> 
> 	Hans
> 
>>
>> ---
>>
>> Changes in v7:
>> - fix check of return value of of_clk_get
>> - fix identation
>>
>> Changes in v6: None
>> Changes in v5: None
>> Changes in v4: None
>> Changes in v3: None
>> Changes in v2: None
>>
>>  drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
>> index 0c4788af78dd..58abfbdfb82d 100644
>> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
>> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
>> @@ -110,6 +110,12 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
>>  
>>  	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
>>  		comp->clk[i] = of_clk_get(node, i);
>> +		if (IS_ERR(comp->clk[i])) {
>> +			if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER)
>> +				dev_err(dev, "Failed to get clock\n");
>> +
>> +			return PTR_ERR(comp->clk[i]);
>> +		}
>>  
>>  		/* Only RDMA needs two clocks */
>>  		if (comp->type != MTK_MDP_RDMA)
>>
>
diff mbox series

Patch

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index 0c4788af78dd..58abfbdfb82d 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -110,6 +110,12 @@  int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		comp->clk[i] = of_clk_get(node, i);
+		if (IS_ERR(comp->clk[i])) {
+			if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER)
+				dev_err(dev, "Failed to get clock\n");
+
+			return PTR_ERR(comp->clk[i]);
+		}
 
 		/* Only RDMA needs two clocks */
 		if (comp->type != MTK_MDP_RDMA)