Skip to contentSkip to conversation

clk: ti: divider: add driver internal API for parsing divider data

bug report Dan Carpenter 3 participants 3 messages Apr 11, 2017 – Apr 12, 2017 Common clk

lore
Share & tools
lore
#0 lore raw

Hello Tero Kristo,

The patch 4f6be5655dc9: "clk: ti: divider: add driver internal API for parsing divider data" from Feb 9, 2017, leads to the following static checker warning:

drivers/clk/ti/divider.c:457 ti_clk_register_divider()
warn: 'table' isn't an ERR_PTR

drivers/clk/ti/divider.c
453 if (div->flags & CLKF_SET_RATE_PARENT)
454 flags |= CLK_SET_RATE_PARENT;
455
456 table = _get_div_table_from_setup(div, &width);
457 if (IS_ERR(table))

                    ^^^^^^^^^^^^

This needs to be updated to a NULL check.

458 return (struct clk *)table;
459
460 clk = _register_divider(NULL, setup->name, div->parent,
461 flags, (void __iomem *)reg, div->bit_shift,
462 width, div_flags, table);

regards,
dan carpenter

#1 lore raw
Quoted 9 lines · Dan Carpenter

Hello Tero Kristo,

The patch 4f6be5655dc9: "clk: ti: divider: add driver internal API for parsing divider data" from Feb 9, 2017, leads to the following static checker warning:

drivers/clk/ti/divider.c:457 ti_clk_register_divider()
warn: 'table' isn't an ERR_PTR

Quoted 8 lines

drivers/clk/ti/divider.c
453 if (div->flags & CLKF_SET_RATE_PARENT)

   454                  flags |= CLK_SET_RATE_PARENT;
   455
   456          table = _get_div_table_from_setup(div, &width);
   457          if (IS_ERR(table))
                    ^^^^^^^^^^^^

This needs to be updated to a NULL check.

Thanks for catching.

I'll send a fix for this against 4.12-rc1. Only case where this can fail is if we run out of memory during boot which is pretty unlikely.

-Tero

Quoted 10 lines
   458                  return (struct clk *)table;
   459
   460          clk = _register_divider(NULL, setup->name, div->parent,
   461                                  flags, (void __iomem *)reg, div->bit_shift,
   462                                  width, div_flags, table);

regards,
dan carpenter

#2 lore raw
Quoted 19 lines · Tero Kristo
Quoted 9 lines · Dan Carpenter

Hello Tero Kristo,

The patch 4f6be5655dc9: "clk: ti: divider: add driver internal API for parsing divider data" from Feb 9, 2017, leads to the following static checker warning:

drivers/clk/ti/divider.c:457 ti_clk_register_divider()
warn: 'table' isn't an ERR_PTR

Quoted 8 lines

drivers/clk/ti/divider.c
453 if (div->flags & CLKF_SET_RATE_PARENT)
454 flags |= CLK_SET_RATE_PARENT;
455
456 table = _get_div_table_from_setup(div, &width);
457 if (IS_ERR(table))

                   ^^^^^^^^^^^^

This needs to be updated to a NULL check.

Quoted 6 lines

Thanks for catching.

I'll send a fix for this against 4.12-rc1. Only case where this can fail is if we run out of memory during boot which is pretty unlikely.

Ok.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project