]> Git Repo - linux.git/commitdiff
pcmcia: Use resource_size function on resource object
authorJules Irenge <[email protected]>
Sun, 12 May 2024 22:31:21 +0000 (23:31 +0100)
committerDominik Brodowski <[email protected]>
Sun, 30 Jun 2024 13:34:51 +0000 (15:34 +0200)
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 <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
drivers/pcmcia/yenta_socket.c

index 1365eaa20ff49af09896a5579d9236a1bfd9131b..ff169124929cc26cbffdc7cd2ef7279d482f72ba 100644 (file)
@@ -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)
This page took 0.060264 seconds and 4 git commands to generate.