From: Jules Irenge Date: Sun, 12 May 2024 22:31:21 +0000 (+0100) Subject: pcmcia: Use resource_size function on resource object X-Git-Tag: v6.11-rc1~71^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24a025497e7e883bd2adef5d0ece1e9b9268009f;p=thirdparty%2Fkernel%2Flinux.git pcmcia: Use resource_size function on resource object Cocinnele reports a warning WARNING: Suspicious code. resource_size is maybe missing with root The root cause is the function resource_size is not used when needed Use resource_size() on variable "root" of type resource Signed-off-by: Jules Irenge Signed-off-by: Dominik Brodowski --- diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 1365eaa20ff49..ff169124929cc 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -638,11 +638,11 @@ static int yenta_search_one_res(struct resource *root, struct resource *res, start = PCIBIOS_MIN_CARDBUS_IO; end = ~0U; } else { - unsigned long avail = root->end - root->start; + unsigned long avail = resource_size(root); int i; size = BRIDGE_MEM_MAX; - if (size > avail/8) { - size = (avail+1)/8; + if (size > (avail - 1) / 8) { + size = avail / 8; /* round size down to next power of 2 */ i = 0; while ((size /= 2) != 0)