diff mbox series

platform/x86: p2sb: Make p2sb_get_devfn() return void

Message ID 20240305094500.23778-1-hdegoede@redhat.com (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: p2sb: Make p2sb_get_devfn() return void | expand

Commit Message

Hans de Goede March 5, 2024, 9:45 a.m. UTC
p2sb_get_devfn() always succeeds, make it return void and
remove error checking from its callers.

Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note this applies on top of pdx86/fixes I plan to merge this
small cleanup into for-next after 6.9-rc1
---
 drivers/platform/x86/p2sb.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Shinichiro Kawasaki March 6, 2024, 1:58 a.m. UTC | #1
On Mar 05, 2024 / 10:45, Hans de Goede wrote:
> p2sb_get_devfn() always succeeds, make it return void and
> remove error checking from its callers.
> 
> Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Thanks, looks good to me.

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Hans de Goede March 25, 2024, 2:39 p.m. UTC | #2
Hi,

On 3/6/24 2:58 AM, Shinichiro Kawasaki wrote:
> On Mar 05, 2024 / 10:45, Hans de Goede wrote:
>> p2sb_get_devfn() always succeeds, make it return void and
>> remove error checking from its callers.
>>
>> Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Thanks, looks good to me.
> 
> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Thank you.

I've added this to my review-hans (soon to be for-next) branch now.

Regards,

Hans
diff mbox series

Patch

diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c
index 3d66e1d4eb1f..53fe96b99ab7 100644
--- a/drivers/platform/x86/p2sb.c
+++ b/drivers/platform/x86/p2sb.c
@@ -43,7 +43,7 @@  struct p2sb_res_cache {
 
 static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE];
 
-static int p2sb_get_devfn(unsigned int *devfn)
+static void p2sb_get_devfn(unsigned int *devfn)
 {
 	unsigned int fn = P2SB_DEVFN_DEFAULT;
 	const struct x86_cpu_id *id;
@@ -53,7 +53,6 @@  static int p2sb_get_devfn(unsigned int *devfn)
 		fn = (unsigned int)id->driver_data;
 
 	*devfn = fn;
-	return 0;
 }
 
 static bool p2sb_valid_resource(struct resource *res)
@@ -135,9 +134,7 @@  static int p2sb_cache_resources(void)
 	int ret;
 
 	/* Get devfn for P2SB device itself */
-	ret = p2sb_get_devfn(&devfn_p2sb);
-	if (ret)
-		return ret;
+	p2sb_get_devfn(&devfn_p2sb);
 
 	bus = p2sb_get_bus(NULL);
 	if (!bus)
@@ -194,17 +191,13 @@  static int p2sb_cache_resources(void)
 int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem)
 {
 	struct p2sb_res_cache *cache;
-	int ret;
 
 	bus = p2sb_get_bus(bus);
 	if (!bus)
 		return -ENODEV;
 
-	if (!devfn) {
-		ret = p2sb_get_devfn(&devfn);
-		if (ret)
-			return ret;
-	}
+	if (!devfn)
+		p2sb_get_devfn(&devfn);
 
 	cache = &p2sb_resources[PCI_FUNC(devfn)];
 	if (cache->bus_dev_id != bus->dev.id)