diff options
author | Arnd Bergmann <arnd@arndb.de> | 2023-12-15 00:02:22 +0300 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2023-12-15 00:02:22 +0300 |
commit | d73ad797c83b0777407a2200bbefa3cb82759247 (patch) | |
tree | 93a739132247d9d18044d2c7b822b90228b62c7d /drivers | |
parent | 81556f228c0e7b3681e1002eb182efc4c1410c72 (diff) | |
parent | 4a6756f56bcf8e64c87144a626ce53aea4899c0e (diff) | |
download | linux-d73ad797c83b0777407a2200bbefa3cb82759247.tar.xz |
Merge tag 'reset-fixes-for-v6.7' of git://git.pengutronix.de/pza/linux into arm/fixes
Reset controller fixes for v6.7
Fix a void-pointer-to-enum-cast warning in the hisilicon hi6220 reset
driver and fix a NULL pointer dereference when freeing non-existent
optional resets requested via the reset_array API in the core.
* tag 'reset-fixes-for-v6.7' of git://git.pengutronix.de/pza/linux:
reset: Fix crash when freeing non-existent optional resets
reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning
Link: https://lore.kernel.org/r/20231213152606.231044-1-p.zabel@pengutronix.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/reset/core.c | 8 | ||||
-rw-r--r-- | drivers/reset/hisilicon/hi6220_reset.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 7ece6a8e9858..4d5a78d3c085 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -807,6 +807,9 @@ static void __reset_control_put_internal(struct reset_control *rstc) { lockdep_assert_held(&reset_list_mutex); + if (IS_ERR_OR_NULL(rstc)) + return; + kref_put(&rstc->refcnt, __reset_control_release); } @@ -1017,11 +1020,8 @@ EXPORT_SYMBOL_GPL(reset_control_put); void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs) { mutex_lock(&reset_list_mutex); - while (num_rstcs--) { - if (IS_ERR_OR_NULL(rstcs[num_rstcs].rstc)) - continue; + while (num_rstcs--) __reset_control_put_internal(rstcs[num_rstcs].rstc); - } mutex_unlock(&reset_list_mutex); } EXPORT_SYMBOL_GPL(reset_control_bulk_put); diff --git a/drivers/reset/hisilicon/hi6220_reset.c b/drivers/reset/hisilicon/hi6220_reset.c index 8d1fce18ded7..5c3267acd2b1 100644 --- a/drivers/reset/hisilicon/hi6220_reset.c +++ b/drivers/reset/hisilicon/hi6220_reset.c @@ -163,7 +163,7 @@ static int hi6220_reset_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - type = (enum hi6220_reset_ctrl_type)of_device_get_match_data(dev); + type = (uintptr_t)of_device_get_match_data(dev); regmap = syscon_node_to_regmap(np); if (IS_ERR(regmap)) { |