[PATCH 02/22] clk: check pointer returned by dev_get_parent()
Claudiu.Beznea at microchip.com
Claudiu.Beznea at microchip.com
Tue Aug 4 09:19:29 CEST 2020
On 04.08.2020 05:00, Simon Glass wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi Claudiu,
>
> On Wed, 29 Jul 2020 at 08:51, Claudiu Beznea
> <claudiu.beznea at microchip.com> wrote:
>>
>> Check pointer returned by dev_get_parent().
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
>> ---
>> drivers/clk/clk-uclass.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
>> index 70df9d410f4c..aa1f11a27c41 100644
>> --- a/drivers/clk/clk-uclass.c
>> +++ b/drivers/clk/clk-uclass.c
>> @@ -459,6 +459,9 @@ struct clk *clk_get_parent(struct clk *clk)
>> return NULL;
>>
>> pdev = dev_get_parent(clk->dev);
>> + if (!pdev)
>> + return ERR_PTR(-ENOMEM);
>
> A clock device must always have a parent (e.g. the root device). So
> this check is not useful and adds to code size.
Sure, I'll remove it.
> >> +
>> pclk = dev_get_clk_ptr(pdev);
>> if (!pclk)
>> return ERR_PTR(-ENODEV);
>> --
>> 2.7.4
>>
>
> Regards,
> Simon
>
More information about the U-Boot
mailing list