clk: check ops pointer on clock register
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 19 Dec 2017 08:33:29 +0000 (09:33 +0100)
committerMichael Turquette <mturquette@baylibre.com>
Tue, 19 Dec 2017 19:44:21 +0000 (11:44 -0800)
commit29fd2a34ef8d863e48183bd473ba57c8d7839e25
treecabefb26c96b4a3298aab4bcb72cf94cebb068fc
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323
clk: check ops pointer on clock register

Nothing really prevents a provider from (trying to) register a clock
without providing the clock ops structure.

We do check the individual fields before using them, but not the
structure pointer itself. This may have the usual nasty consequences when
the pointer is dereferenced, most likely when checking one the field
during the initialization.

This is fixed by returning an error on clock register if the ops pointer
is NULL.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/20171219083329.24746-1-jbrunet@baylibre.com
drivers/clk/clk.c