mux: core: fix double get_device()
PATCH 1/1 mux: core: fix double get_device()
From: Hans de Goede <[email protected]>
class_find_device already does a get_device on the returned device. So the device returned by of_find_mux_chip_by_node is already referenced and we should not reference it again (and unref it on error).
--- drivers/mux/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Hi Greg,
Here is a fix for 4.15, and it should perhaps also go to stable?
It's been in -next for a couple of weeks w/o complaints.
Cheers,
Peter
drivers/mux/core.c +3 -1
@@ -413,6 +413,7 @@ static int of_dev_node_match(struct device *dev, const void *data)return dev->of_node == data; } +/* Note this function returns a reference to the mux_chip dev. */ static struct mux_chip *of_find_mux_chip_by_node (struct device_node *np) {struct device *dev;
@@ -466,6 +467,7 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name) (!args.args_count && (mux_chip->controllers > 1))) {dev_err (dev,"%pOF: wrong #mux-control-cells for %pOF\n" , np, args.np); +put_device (&mux_chip->dev);return ERR_PTR (-EINVAL ); }
@@ -476,10 +478,10 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)if (controller >= mux_chip->controllers) {dev_err (dev,"%pOF: bad mux controller %u specified in %pOF\n" , np, controller, args.np); +put_device (&mux_chip->dev);return ERR_PTR (-EINVAL ); } -get_device (&mux_chip->dev);return &mux_chip->mux[controller]; }EXPORT_SYMBOL_GPL (mux_control_get);
Signature · 1 line
2.11.0
PATCH 1/1 mux: add SPDX identifiers to all mux source files
Remove all free-text license texts.
This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text.
No copyright headers or other non-license-description text was removed.
--- drivers/mux/Kconfig | 1 + drivers/mux/Makefile | 1 + drivers/mux/adg792a.c | 5 +---- drivers/mux/core.c | 5 +---- drivers/mux/gpio.c | 5 +---- drivers/mux/mmio.c | 5 +---- include/linux/mux/consumer.h | 5 +---- include/linux/mux/driver.h | 5 +---- 8 files changed, 8 insertions(+), 24 deletions(-)
Hi Greg,
Here is a patch for 4.16. I have some documentation updates as well, but I think Corbet is taking those. Not 100% sure though, but I didn't want to risk this one being stalled over that with all the holidays etc.
Cheers,
Peter
drivers/mux/Kconfig +1 -0
@@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # Multiplexer devices #
drivers/mux/Makefile +1 -0
@@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # Makefile for multiplexer devices. #
drivers/mux/adg792a.c +1 -4
@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Multiplexer driver for Analog Devices ADG792A/G Triple 4:1 mux * * Copyright (C) 2017 Axentia Technologies AB * * Author: Peter Rosin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #include <linux/err.h>
drivers/mux/core.c +1 -4
@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Multiplexer subsystem * * Copyright (C) 2017 Axentia Technologies AB * * Author: Peter Rosin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #define pr_fmt (fmt) "mux-core: " fmt
drivers/mux/gpio.c +1 -4
@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * GPIO-controlled multiplexer driver * * Copyright (C) 2017 Axentia Technologies AB * * Author: Peter Rosin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #include <linux/err.h>
drivers/mux/mmio.c +1 -4
@@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * MMIO register bitfield-controlled multiplexer driver * * Copyright (C) 2017 Pengutronix, Philipp Zabel <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #include <linux/bitops.h>
include/linux/mux/consumer.h +1 -4
@@ -1,13 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * mux/consumer.h - definitions for the multiplexer consumer interface * * Copyright (C) 2017 Axentia Technologies AB * * Author: Peter Rosin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #ifndef _LINUX_MUX_CONSUMER_H
include/linux/mux/driver.h +1 -4
@@ -1,13 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * mux/driver.h - definitions for the multiplexer driver interface * * Copyright (C) 2017 Axentia Technologies AB * * Author: Peter Rosin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. */ #ifndef _LINUX_MUX_DRIVER_H
Signature · 1 line
2.11.0