Skip to content

Commit 3ff5873

Browse files
committed
platform/x86: p2sb: Make p2sb_get_devfn() return void
p2sb_get_devfn() always succeeds, make it return void and remove error checking from its callers. Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240305094500.23778-1-hdegoede@redhat.com
1 parent 4cece76 commit 3ff5873

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/platform/x86/p2sb.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct p2sb_res_cache {
4343

4444
static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE];
4545

46-
static int p2sb_get_devfn(unsigned int *devfn)
46+
static void p2sb_get_devfn(unsigned int *devfn)
4747
{
4848
unsigned int fn = P2SB_DEVFN_DEFAULT;
4949
const struct x86_cpu_id *id;
@@ -53,7 +53,6 @@ static int p2sb_get_devfn(unsigned int *devfn)
5353
fn = (unsigned int)id->driver_data;
5454

5555
*devfn = fn;
56-
return 0;
5756
}
5857

5958
static bool p2sb_valid_resource(struct resource *res)
@@ -135,9 +134,7 @@ static int p2sb_cache_resources(void)
135134
int ret;
136135

137136
/* Get devfn for P2SB device itself */
138-
ret = p2sb_get_devfn(&devfn_p2sb);
139-
if (ret)
140-
return ret;
137+
p2sb_get_devfn(&devfn_p2sb);
141138

142139
bus = p2sb_get_bus(NULL);
143140
if (!bus)
@@ -194,17 +191,13 @@ static int p2sb_cache_resources(void)
194191
int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem)
195192
{
196193
struct p2sb_res_cache *cache;
197-
int ret;
198194

199195
bus = p2sb_get_bus(bus);
200196
if (!bus)
201197
return -ENODEV;
202198

203-
if (!devfn) {
204-
ret = p2sb_get_devfn(&devfn);
205-
if (ret)
206-
return ret;
207-
}
199+
if (!devfn)
200+
p2sb_get_devfn(&devfn);
208201

209202
cache = &p2sb_resources[PCI_FUNC(devfn)];
210203
if (cache->bus_dev_id != bus->dev.id)

0 commit comments

Comments
 (0)