Skip to content

Commit 24a0254

Browse files
irengeDominik Brodowski
authored andcommitted
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 <[email protected]> Signed-off-by: Dominik Brodowski <[email protected]>
1 parent 02d5150 commit 24a0254

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/pcmcia/yenta_socket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,11 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
638638
start = PCIBIOS_MIN_CARDBUS_IO;
639639
end = ~0U;
640640
} else {
641-
unsigned long avail = root->end - root->start;
641+
unsigned long avail = resource_size(root);
642642
int i;
643643
size = BRIDGE_MEM_MAX;
644-
if (size > avail/8) {
645-
size = (avail+1)/8;
644+
if (size > (avail - 1) / 8) {
645+
size = avail / 8;
646646
/* round size down to next power of 2 */
647647
i = 0;
648648
while ((size /= 2) != 0)

0 commit comments

Comments
 (0)