* [PATCH] reset: brcmstb: Fix resource checks
@ 2019-11-01 3:06 Florian Fainelli
2019-11-01 3:09 ` Florian Fainelli
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2019-11-01 3:06 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Florian Fainelli, Philipp Zabel,
maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE, open list
The use of IS_ALIGNED() is incorrect, the typical resource we pass looks
like this: start: 0x8404318, size: 0x30. When using IS_ALIGNED() we will
get the following 0x8404318 & (0x18 - 1) = 0x10 which is definitively
not equal to 0.
Replace this with an appropriate check on the start address and the
resource size to be a multiple of SW_INIT_BANK_SIZE.
Fixes: 77750bc089e4 ("reset: Add Broadcom STB SW_INIT reset controller driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/reset/reset-brcmstb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-brcmstb.c b/drivers/reset/reset-brcmstb.c
index a608f445dad6..21ca6fa51365 100644
--- a/drivers/reset/reset-brcmstb.c
+++ b/drivers/reset/reset-brcmstb.c
@@ -91,8 +91,8 @@ static int brcmstb_reset_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!IS_ALIGNED(res->start, SW_INIT_BANK_SIZE) ||
- !IS_ALIGNED(resource_size(res), SW_INIT_BANK_SIZE)) {
+ if ((res->start & SW_INIT_BANK_SIZE) != SW_INIT_BANK_SIZE ||
+ resource_size(res) % SW_INIT_BANK_SIZE) {
dev_err(kdev, "incorrect register range\n");
return -EINVAL;
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] reset: brcmstb: Fix resource checks
2019-11-01 3:06 [PATCH] reset: brcmstb: Fix resource checks Florian Fainelli
@ 2019-11-01 3:09 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2019-11-01 3:09 UTC (permalink / raw)
To: linux-arm-kernel, Philipp Zabel
Cc: maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE, open list
On 10/31/2019 8:06 PM, Florian Fainelli wrote:
> The use of IS_ALIGNED() is incorrect, the typical resource we pass looks
> like this: start: 0x8404318, size: 0x30. When using IS_ALIGNED() we will
> get the following 0x8404318 & (0x18 - 1) = 0x10 which is definitively
> not equal to 0.
>
> Replace this with an appropriate check on the start address and the
> resource size to be a multiple of SW_INIT_BANK_SIZE.
>
> Fixes: 77750bc089e4 ("reset: Add Broadcom STB SW_INIT reset controller driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Sorry this fails building on 32-bit because it triggers a 64-bit
division let me go back and fix this...
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-01 3:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 3:06 [PATCH] reset: brcmstb: Fix resource checks Florian Fainelli
2019-11-01 3:09 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®