summaryrefslogtreecommitdiff
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorJules Irenge <jbi.octave@gmail.com>2024-05-13 01:31:21 +0300
committerDominik Brodowski <linux@dominikbrodowski.net>2024-06-30 16:34:51 +0300
commit24a025497e7e883bd2adef5d0ece1e9b9268009f (patch)
treec781fc1a35e1455263f0ca47cf4dfdc2b560b3b0 /drivers/pcmcia
parent02d51503324cb699ef248ece47cbdc2f2a61eb73 (diff)
downloadlinux-24a025497e7e883bd2adef5d0ece1e9b9268009f.tar.xz
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 <jbi.octave@gmail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/yenta_socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 1365eaa20ff4..ff169124929c 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)