* [PATCH 01/15] arm: friendlyarm-tiny210: Remove dead code
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 02/15] ARM: socfpga: Fix timeout tests Sascha Hauer
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
pin_usage[] is an empty array, no need to iterate over it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/friendlyarm-tiny210/tiny210.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/arch/arm/boards/friendlyarm-tiny210/tiny210.c b/arch/arm/boards/friendlyarm-tiny210/tiny210.c
index c96aa83059..c47f488207 100644
--- a/arch/arm/boards/friendlyarm-tiny210/tiny210.c
+++ b/arch/arm/boards/friendlyarm-tiny210/tiny210.c
@@ -31,11 +31,6 @@
#include <mach/s3c-clocks.h>
#include <mach/s3c-generic.h>
-
-static const unsigned pin_usage[] = {
- /* TODO */
-};
-
static struct gpio_led leds[] = {
{
.gpio = GPJ20,
@@ -91,8 +86,6 @@ console_initcall(tiny210_console_init);
static int tiny210_devices_init(void)
{
int i;
- for (i = 0; i < ARRAY_SIZE(pin_usage); i++)
- s3c_gpio_mode(pin_usage[i]);
for (i = 0; i < ARRAY_SIZE(leds); i++) {
leds[i].active_low = 1;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 02/15] ARM: socfpga: Fix timeout tests
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
2021-05-17 18:54 ` [PATCH 01/15] arm: friendlyarm-tiny210: Remove dead code Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 03/15] i.MX FCB: Fix error checking Sascha Hauer
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
A timeout is never detected as timeout is tested for being smaller than
0 which never happens for an unsigned variable. Change to a signed type.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-socfpga/arria10-xload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-socfpga/arria10-xload.c b/arch/arm/mach-socfpga/arria10-xload.c
index 6f137e300e..e52fd1ed87 100644
--- a/arch/arm/mach-socfpga/arria10-xload.c
+++ b/arch/arm/mach-socfpga/arria10-xload.c
@@ -136,7 +136,7 @@ static int a10_fpga_init(void *buf)
{
uint32_t stat, mask;
uint32_t val;
- uint32_t timeout;
+ int timeout;
val = CFGWDTH_32 << A10_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SHIFT;
a10_update_bits(A10_FPGAMGR_IMGCFG_CTL_02_OFST,
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 03/15] i.MX FCB: Fix error checking
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
2021-05-17 18:54 ` [PATCH 01/15] arm: friendlyarm-tiny210: Remove dead code Sascha Hauer
2021-05-17 18:54 ` [PATCH 02/15] ARM: socfpga: Fix timeout tests Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 04/15] clk: tegra: Fix -Wtype-limits compiler warning Sascha Hauer
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
The return value of imx_bbu_firmware_fcb_start_page() is assigned to an
unsigned type which is then tested for an error (<0). Test against a
signed variable instead to let the error checking actually work.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/imx-bbu-nand-fcb.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 4e680a0a51..3b07d539ee 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1263,16 +1263,17 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
free(fcb);
fcb = xzalloc(sizeof(*fcb));
- fcb->Firmware1_startingPage = imx_bbu_firmware_fcb_start_page(mtd, !used);
- if (fcb->Firmware1_startingPage < 0) {
- ret = fcb->Firmware1_startingPage;
+
+ ret = imx_bbu_firmware_fcb_start_page(mtd, !used);
+ if (ret < 0)
goto out;
- }
- fcb->Firmware2_startingPage = imx_bbu_firmware_fcb_start_page(mtd, used);
- if (fcb->Firmware2_startingPage < 0) {
- ret = fcb->Firmware2_startingPage;
+ fcb->Firmware1_startingPage = ret;
+
+ ret = imx_bbu_firmware_fcb_start_page(mtd, used);
+ if (ret < 0)
goto out;
- }
+ fcb->Firmware2_startingPage = ret;
+
fcb->PagesInFirmware1 = fw_size / mtd->writesize;
fcb->PagesInFirmware2 = fcb->PagesInFirmware1;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 04/15] clk: tegra: Fix -Wtype-limits compiler warning
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (2 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 03/15] i.MX FCB: Fix error checking Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 05/15] ARM: i.MX: xload-gpmi: Fix " Sascha Hauer
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
divider_ux1 is checked for being smaller than 0 which can never happen
for an unsigned variable. Fix the check in a way it's currently done in
Linux
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/tegra/clk-divider.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c
index cc8b85520c..8ac8c98e9f 100644
--- a/drivers/clk/tegra/clk-divider.c
+++ b/drivers/clk/tegra/clk-divider.c
@@ -46,11 +46,11 @@ static int get_div(struct tegra_clk_frac_div *divider, unsigned long rate,
if (flags & TEGRA_DIVIDER_INT)
divider_ux1 *= mul;
- divider_ux1 -= mul;
-
- if (divider_ux1 < 0)
+ if (divider_ux1 < mul)
return 0;
+ divider_ux1 -= mul;
+
if (divider_ux1 > get_max_div(divider))
return -EINVAL;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 05/15] ARM: i.MX: xload-gpmi: Fix compiler warning
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (3 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 04/15] clk: tegra: Fix -Wtype-limits compiler warning Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 06/15] mtd: cfi-flash: " Sascha Hauer
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
'pdesc' is a pointer casted to a 32bit value. This rightfully issues a
compiler warning when being compiled with a 64bit toolchain. This code
is compiled on 64bit systems, but the hardware won't be used there.
Just silence the warning by casting the pointer to unsigned long.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/xload-gpmi-nand.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/xload-gpmi-nand.c b/arch/arm/mach-imx/xload-gpmi-nand.c
index b3fd479cb4..deb7f4806e 100644
--- a/arch/arm/mach-imx/xload-gpmi-nand.c
+++ b/arch/arm/mach-imx/xload-gpmi-nand.c
@@ -111,14 +111,15 @@ static int mxs_dma_enable(struct mxs_dma_chan *pchan,
struct apbh_dma *apbh = pchan->apbh;
int channel_bit;
int channel = pchan->channel;
+ unsigned long pdesc32 = (unsigned long)pdesc;
if (apbh_dma_is_imx23(apbh)) {
- writel((uint32_t)pdesc,
+ writel(pdesc32,
apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX23(channel));
writel(1, apbh->regs + HW_APBHX_CHn_SEMA_MX23(channel));
channel_bit = channel + BP_APBH_CTRL0_CLKGATE_CHANNEL;
} else {
- writel((uint32_t)pdesc,
+ writel(pdesc32,
apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX28(channel));
writel(1, apbh->regs + HW_APBHX_CHn_SEMA_MX28(channel));
channel_bit = channel;
@@ -174,7 +175,7 @@ static int mxs_dma_run(struct mxs_dma_chan *pchan, struct mxs_dma_cmd *pdesc,
/* chain descriptors */
for (i = 0; i < num - 1; i++) {
- pdesc[i].next = (uint32_t)(&pdesc[i + 1]);
+ pdesc[i].next = (unsigned long)(&pdesc[i + 1]);
pdesc[i].data |= DMACMD_CHAIN;
}
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 06/15] mtd: cfi-flash: Fix compiler warning
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (4 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 05/15] ARM: i.MX: xload-gpmi: Fix " Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 07/15] pci: mvebu: Fix wrong error check Sascha Hauer
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
sector >= 0 is always true for the unsigned type flash_sect_t. This
means the loop to find the sector will only behave correctly when we
actually find the sector, but not in the error case. The error case
is not expected though and will not happen when the code is correct,
so just catch it with a BUG().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mtd/nor/cfi_flash.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index ba0bd1b4eb..ffd29d80a7 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -466,9 +466,16 @@ flash_sect_t find_sector(struct flash_info *info, unsigned long addr)
{
flash_sect_t sector;
- for (sector = info->sector_count - 1; sector >= 0; sector--) {
+ sector = info->sector_count - 1;
+
+ while (1) {
if (addr >= info->start[sector])
break;
+
+ if (sector == 0)
+ BUG();
+
+ sector--;
}
return sector;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 07/15] pci: mvebu: Fix wrong error check
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (5 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 06/15] mtd: cfi-flash: " Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 08/15] ARM: i.MX bbu-external-nand: Do not modify image Sascha Hauer
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/pci/pci-mvebu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci-mvebu.c b/drivers/pci/pci-mvebu.c
index ae2e83dacd..0c5e34116c 100644
--- a/drivers/pci/pci-mvebu.c
+++ b/drivers/pci/pci-mvebu.c
@@ -270,8 +270,8 @@ static struct mvebu_pcie *mvebu_pcie_port_probe(struct device_d *dev,
enum of_gpio_flags flags;
struct property *prop;
const __be32 *p;
- int reset_gpio;
- u32 u, port, lane, lane_mask, devfn;
+ int reset_gpio, devfn;
+ u32 u, port, lane, lane_mask;
int mem_target, mem_attr;
int io_target, io_attr;
int ret;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 08/15] ARM: i.MX bbu-external-nand: Do not modify image
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (6 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 07/15] pci: mvebu: Fix wrong error check Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 09/15] ARM: layerscape: Fix wrong error check Sascha Hauer
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
struct bbu_data::image is const, so do not modify the image, but create
a copy instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/imx-bbu-external-nand.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx-bbu-external-nand.c b/arch/arm/mach-imx/imx-bbu-external-nand.c
index 8aa4f152a1..0f7cc51caf 100644
--- a/arch/arm/mach-imx/imx-bbu-external-nand.c
+++ b/arch/arm/mach-imx/imx-bbu-external-nand.c
@@ -39,7 +39,7 @@ static int imx_bbu_external_nand_update(struct bbu_handler *handler, struct bbu_
uint32_t num_bb = 0, bbt = 0;
loff_t offset = 0;
int block = 0, len, now, blocksize;
- void *image = data->image;
+ void *image = NULL;
ret = stat(data->devicefile, &s);
if (ret)
@@ -55,6 +55,12 @@ static int imx_bbu_external_nand_update(struct bbu_handler *handler, struct bbu_
if (ret)
goto out;
+ image = memdup(data->image, data->len);
+ if (!image) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
blocksize = meminfo.erasesize;
size_need = data->len;
@@ -172,6 +178,7 @@ static int imx_bbu_external_nand_update(struct bbu_handler *handler, struct bbu_
out:
close(fd);
+ free(image);
return ret;
}
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 09/15] ARM: layerscape: Fix wrong error check
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (7 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 08/15] ARM: i.MX bbu-external-nand: Do not modify image Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 10/15] ARM: phytec-phycard-omap3: Fix checking of unsigned variable being negative Sascha Hauer
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
The return value of get_fman_port_icid() is assigned to an unsigned
variable which is then error checked for being smaller than 0. Convert
the variable to a signed type to make this work.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-layerscape/icid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-layerscape/icid.c b/arch/arm/mach-layerscape/icid.c
index aec57f4b3f..644401b181 100644
--- a/arch/arm/mach-layerscape/icid.c
+++ b/arch/arm/mach-layerscape/icid.c
@@ -305,8 +305,8 @@ static void fdt_fixup_fman_port_icid_by_compat(struct device_node *root,
const char *compat)
{
struct device_node *np;
- int ret;
- u32 cell_index, icid;
+ int ret, icid;
+ u32 cell_index;
for_each_compatible_node_from(np, root, NULL, compat) {
ret = of_property_read_u32(np, "cell-index", &cell_index);
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 10/15] ARM: phytec-phycard-omap3: Fix checking of unsigned variable being negative
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (8 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 09/15] ARM: layerscape: Fix wrong error check Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 11/15] scripts: zynq_mkimage: Make locally used function static Sascha Hauer
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
'char' can be unsigned, make it signed explicitly to let the check for
being smaller than 0 work..
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/phytec-phycard-omap3/lowlevel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boards/phytec-phycard-omap3/lowlevel.c b/arch/arm/boards/phytec-phycard-omap3/lowlevel.c
index 54d8eaaddf..546fa78735 100644
--- a/arch/arm/boards/phytec-phycard-omap3/lowlevel.c
+++ b/arch/arm/boards/phytec-phycard-omap3/lowlevel.c
@@ -98,7 +98,7 @@ static void config_sdram_ddr(u8 cs, u8 cfg)
static void pcaal1_sdrc_init(void)
{
u32 test0, test1;
- char cfg;
+ signed char cfg;
init_sdram_ddr();
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 11/15] scripts: zynq_mkimage: Make locally used function static
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (9 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 10/15] ARM: phytec-phycard-omap3: Fix checking of unsigned variable being negative Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 12/15] ARM: module: Remove always false check Sascha Hauer
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
parse_config() is defined and used only in one file. Make it static.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/zynq_mkimage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/zynq_mkimage.c b/scripts/zynq_mkimage.c
index 8b95b41960..b611d5c69b 100644
--- a/scripts/zynq_mkimage.c
+++ b/scripts/zynq_mkimage.c
@@ -142,7 +142,7 @@ static char *readcmd(FILE *f)
}
}
-int parse_config(char *buf, const char *filename)
+static int parse_config(char *buf, const char *filename)
{
FILE *f;
int lineno = 0;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 12/15] ARM: module: Remove always false check
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (10 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 11/15] scripts: zynq_mkimage: Make locally used function static Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 13/15] aiodev: lm75: Handle unknown lm75 types Sascha Hauer
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
rel->r_offset < 0 is always false because r_offset is unsigned. Remove
check.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib32/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/lib32/module.c b/arch/arm/lib32/module.c
index 5073675180..7214e3c73c 100644
--- a/arch/arm/lib32/module.c
+++ b/arch/arm/lib32/module.c
@@ -38,7 +38,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
- if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
+ if (rel->r_offset > dstsec->sh_size - sizeof(u32)) {
printf("%s: out of bounds relocation, "
"section %u reloc %u offset %d size %d\n",
module->name, relindex, i, rel->r_offset,
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 13/15] aiodev: lm75: Handle unknown lm75 types
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (11 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 12/15] ARM: module: Remove always false check Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 14/15] clk: zynqmp: Fix wrong error check Sascha Hauer
2021-05-17 18:54 ` [PATCH 15/15] powerpc: law: use signed type to allow error checking Sascha Hauer
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
lm75 type unknown is not handled in the switch/case handling all types.
Handle it to avoid compiler warnings.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/aiodev/lm75.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/aiodev/lm75.c b/drivers/aiodev/lm75.c
index 8e5948f468..1900636555 100644
--- a/drivers/aiodev/lm75.c
+++ b/drivers/aiodev/lm75.c
@@ -182,6 +182,8 @@ static int lm75_probe(struct device_d *dev)
clr_mask |= 1 << 5; /* not one-shot mode */
data->resolution = 12;
break;
+ default:
+ return -EINVAL;
}
/* configure as specified */
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 14/15] clk: zynqmp: Fix wrong error check
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (12 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 13/15] aiodev: lm75: Handle unknown lm75 types Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
2021-05-17 18:54 ` [PATCH 15/15] powerpc: law: use signed type to allow error checking Sascha Hauer
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
The return value of zynqmp_get_parent_names() is assigned to an unsigned
type which is then checked for being smaller than zero. Use a signed
type instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/zynqmp/clkc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 366a12e70a..86d85b6daa 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -453,7 +453,7 @@ static int zynqmp_register_clocks(struct device_d *dev,
const char *parent_names[MAX_PARENT];
char *name;
struct device_node *node = dev->device_node;
- unsigned int num_parents;
+ int num_parents;
for (i = 0; i < num_clocks; i++) {
if (zynqmp_get_clock_type(i) != CLK_TYPE_OUTPUT)
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 15/15] powerpc: law: use signed type to allow error checking
2021-05-17 18:54 [PATCH 00/15] Compiler warning fixes Sascha Hauer
` (13 preceding siblings ...)
2021-05-17 18:54 ` [PATCH 14/15] clk: zynqmp: Fix wrong error check Sascha Hauer
@ 2021-05-17 18:54 ` Sascha Hauer
14 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2021-05-17 18:54 UTC (permalink / raw)
To: Barebox List
unsigned idx is checked for >= 0 which is always true and < 0 which is
never true. Use a signed type instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/powerpc/mach-mpc85xx/fsl_law.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/mach-mpc85xx/fsl_law.c b/arch/powerpc/mach-mpc85xx/fsl_law.c
index 2254c92544..e3c765f30f 100644
--- a/arch/powerpc/mach-mpc85xx/fsl_law.c
+++ b/arch/powerpc/mach-mpc85xx/fsl_law.c
@@ -81,7 +81,7 @@ static void fsl_set_next_law(phys_addr_t addr, enum law_size sz,
static void fsl_set_last_law(phys_addr_t addr, enum law_size sz,
enum law_trgt_if id)
{
- u32 idx;
+ int idx;
for (idx = (FSL_HW_NUM_LAWS - 1); idx >= 0; idx--) {
if (fsl_is_free_law(idx)) {
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 16+ messages in thread