Commit 97bcdf24 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'reset-fixes-for-v6.2' of git://git.pengutronix.de/pza/linux into arm/fixes

Reset controller fixes for v6.2

Avoid a build error by disabling the invalid combination of building
reset-ti-sci built-in but ti-sci as a module.
Fix a possible NULL pointer dereference in reset-uniphier-glue in case
platform_get_resource() fails.

* tag 'reset-fixes-for-v6.2' of git://git.pengutronix.de/pza/linux:
  reset: uniphier-glue: Fix possible null-ptr-deref
  reset: ti-sci: honor TI_SCI_PROTOCOL setting when not COMPILE_TEST

Link: https://lore.kernel.org/r/20230104095855.3809733-1-p.zabel@pengutronix.deSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 13d15955 3a2390c6
...@@ -257,7 +257,7 @@ config RESET_SUNXI ...@@ -257,7 +257,7 @@ config RESET_SUNXI
config RESET_TI_SCI config RESET_TI_SCI
tristate "TI System Control Interface (TI-SCI) reset driver" tristate "TI System Control Interface (TI-SCI) reset driver"
depends on TI_SCI_PROTOCOL || COMPILE_TEST depends on TI_SCI_PROTOCOL || (COMPILE_TEST && TI_SCI_PROTOCOL=n)
help help
This enables the reset driver support over TI System Control Interface This enables the reset driver support over TI System Control Interface
available on some new TI's SoCs. If you wish to use reset resources available on some new TI's SoCs. If you wish to use reset resources
......
...@@ -47,7 +47,6 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -47,7 +47,6 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct uniphier_glue_reset_priv *priv; struct uniphier_glue_reset_priv *priv;
struct resource *res; struct resource *res;
resource_size_t size;
int i, ret; int i, ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
...@@ -60,7 +59,6 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -60,7 +59,6 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
size = resource_size(res);
priv->rdata.membase = devm_ioremap_resource(dev, res); priv->rdata.membase = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->rdata.membase)) if (IS_ERR(priv->rdata.membase))
return PTR_ERR(priv->rdata.membase); return PTR_ERR(priv->rdata.membase);
...@@ -96,7 +94,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) ...@@ -96,7 +94,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev)
spin_lock_init(&priv->rdata.lock); spin_lock_init(&priv->rdata.lock);
priv->rdata.rcdev.owner = THIS_MODULE; priv->rdata.rcdev.owner = THIS_MODULE;
priv->rdata.rcdev.nr_resets = size * BITS_PER_BYTE; priv->rdata.rcdev.nr_resets = resource_size(res) * BITS_PER_BYTE;
priv->rdata.rcdev.ops = &reset_simple_ops; priv->rdata.rcdev.ops = &reset_simple_ops;
priv->rdata.rcdev.of_node = dev->of_node; priv->rdata.rcdev.of_node = dev->of_node;
priv->rdata.active_low = true; priv->rdata.active_low = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment