Re: [PATCH 04/11] clk: ti: clkctrl: support multiple clkctrl nodes under a cm node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 12, 2018 at 4:25 PM Stephen Boyd <sboyd@xxxxxxxxxx> wrote:
>
> Quoting Tero Kristo (2018-08-31 08:07:00)
> > @@ -492,19 +501,35 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
> >
> >         provider->base = of_iomap(node, 0);
> >
> > -       provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
> > -                                      GFP_KERNEL);
> > -       if (!provider->clkdm_name) {
> > -               kfree(provider);
> > -               return;
> > +       if (ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT) {
> > +               provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
> > +                                              GFP_KERNEL);
> > +               if (!provider->clkdm_name) {
> > +                       kfree(provider);
> > +                       return;
> > +               }
> > +
> > +               /*
> > +                * Create default clkdm name, replace _cm from end of parent
> > +                * node name with _clkdm
> > +                */
> > +               strcpy(provider->clkdm_name, node->parent->name);

kasprintf can replace kmalloc, strlen and strcpy here and remove the
direct access of .name in the process.

> > +               provider->clkdm_name[strlen(provider->clkdm_name) - 2] = 0;
> > +       } else {
> > +               provider->clkdm_name = kmalloc(strlen(node->name), GFP_KERNEL);
> > +               if (!provider->clkdm_name) {
> > +                       kfree(provider);
> > +                       return;
> > +               }
> > +
> > +               /*
> > +                * Create default clkdm name, replace _clkctrl from end of
> > +                * node name with _clkdm
> > +                */
> > +               strcpy(provider->clkdm_name, node->name);

and here.

> > +               provider->clkdm_name[strlen(provider->clkdm_name) - 7] = 0;
> >         }
> >
>
> This conflicts with Rob's change so I tried to fix it up. Let me know if
> something is horribly wrong with it. I suspect Rob will need to figure
> out how to make node::name usage go away again, but I put it back.

Then I don't have to find and fix. :)

Rob



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux