From 1e91a0ea326f2005d34921c4bc37a35eeccad368 Mon Sep 17 00:00:00 2001 From: Dai Okamura Date: Fri, 9 Dec 2022 20:33:46 +0900 Subject: [PATCH] pinctrl: uniphier: add check if pins are valid The pinctrl datas of uniphier SoCs are the minimal subsets of kernel's one, and some tables has no data to save the footprint size. If the board dts tries to match a pin name on no pins defined SoC, the footprint magic code causes "Synchronous Abort". This checks if the 'pins' data is valid, and if empty, avoids the abort with the warning as follows: WARNING at drivers/pinctrl/uniphier/pinctrl-uniphier-core.c:36/uniphier_pinctrl_get_pins_count()! pinctrl_select_state_full: pinctrl_config_one: err=-38 Signed-off-by: Dai Okamura --- drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index 631bb1f963..bdca3f2f71 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -33,6 +33,9 @@ static int uniphier_pinctrl_get_pins_count(struct udevice *dev) const struct uniphier_pinctrl_pin *pins = priv->socdata->pins; int pins_count = priv->socdata->pins_count; + if (WARN_ON(!pins_count)) + return 0; /* no table of pins */ + /* * We do not list all pins in the pin table to save memory footprint. * Report the max pin number + 1 to fake the framework. -- 2.39.5