Skip to contentSkip to conversation

eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()

PATCH New Andy Shevchenko 1 participant 3 messages Jun 7, 2021 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()

device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.

Fixes db15d73e5f0e ("eeprom: idt_89hpesx: Support both ACPI and OF probing")
Cc Huy Duong <[email protected]>
---
 drivers/misc/eeprom/idt_89hpesx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/eeprom/idt_89hpesx.c +1 -0
index 81c70e5bc168..45a61a1f9e98 100644
@@ -1161,6 +1161,7 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
 	else /* if (!fwnode_property_read_bool(node, "read-only")) */
 		pdev->eero = false;
 
+	fwnode_handle_put(fwnode);
 	dev_info(dev, "EEPROM of %d bytes found by 0x%x",
 		pdev->eesize, pdev->eeaddr);
 }
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/3 eeprom: idt_89hpesx: Restore printing the unsupported fwnode name

When iterating over child firmware nodes restore printing the name of ones that are not supported.

While at it, refactor loop body to clearly show that we stop at the first match.

Fixes db15d73e5f0e ("eeprom: idt_89hpesx: Support both ACPI and OF probing")
Cc Huy Duong <[email protected]>
---
 drivers/misc/eeprom/idt_89hpesx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/misc/eeprom/idt_89hpesx.c +3 -4
index 45a61a1f9e98..3e4a594c110b 100644
@@ -1126,11 +1126,10 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
 
 	device_for_each_child_node(dev, fwnode) {
 		ee_id = idt_ee_match_id(fwnode);
-		if (!ee_id) {
-			dev_warn(dev, "Skip unsupported EEPROM device");
-			continue;
-		} else
+		if (ee_id)
 			break;
+
+		dev_warn(dev, "Skip unsupported EEPROM device %pfw\n", fwnode);
 	}
 
 	/* If there is no fwnode EEPROM device, then set zero size */
Signature · 1 line
2.32.0
#2 lore raw

PATCH 3/3 eeprom: idt_89hpesx: use SPDX-License-Identifier

In reply to Andy Shevchenko

Use SPDX-License-Identifier: GPL-2.0-only, instead of hand writing it.

---
 drivers/misc/eeprom/idt_89hpesx.c | 33 +------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)
drivers/misc/eeprom/idt_89hpesx.c +1 -32
index 3e4a594c110b..b0cff4b152da 100644
@@ -1,38 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
- *   This file is provided under a GPLv2 license.  When using or
- *   redistributing this file, you may do so under that license.
- *
- *   GPL LICENSE SUMMARY
- *
  *   Copyright (C) 2016 T-Platforms. All Rights Reserved.
  *
- *   This program is free software; you can redistribute it and/or modify it
- *   under the terms and conditions of the GNU General Public License,
- *   version 2, as published by the Free Software Foundation.
- *
- *   This program is distributed in the hope that it will be useful, but WITHOUT
- *   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- *   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- *   more details.
- *
- *   You should have received a copy of the GNU General Public License along
- *   with this program; if not, it can be found <http://www.gnu.org/licenses/>.
- *
- *   The full GNU General Public License is included in this distribution in
- *   the file called "COPYING".
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  * IDT PCIe-switch NTB Linux driver
  *
  * Contact Information:
Signature · 1 line
2.32.0