[U-Boot] [PATCH 1/8] Kconfig: Drop CONFIG_EMAC_MDIO_PHY_NUM

This particular macro hasn't been used in the code for some time, remove these references that were missed.
Signed-off-by: Tom Rini trini@konsulko.com --- include/configs/calimain.h | 1 - include/configs/ea20.h | 1 - include/configs/omapl138_lcdk.h | 1 - include/configs/tam3517-common.h | 1 - scripts/config_whitelist.txt | 1 - 5 files changed, 5 deletions(-)
diff --git a/include/configs/calimain.h b/include/configs/calimain.h index 425a38f55197..6e2fd3356323 100644 --- a/include/configs/calimain.h +++ b/include/configs/calimain.h @@ -176,7 +176,6 @@ * Network & Ethernet Configuration */ #ifdef CONFIG_DRIVER_TI_EMAC -#define CONFIG_EMAC_MDIO_PHY_NUM 1 #define CONFIG_MII #define CONFIG_BOOTP_DNS #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/ea20.h b/include/configs/ea20.h index 75100718831d..3a5b5c7285d5 100644 --- a/include/configs/ea20.h +++ b/include/configs/ea20.h @@ -79,7 +79,6 @@ * Network & Ethernet Configuration */ #ifdef CONFIG_DRIVER_TI_EMAC -#define CONFIG_EMAC_MDIO_PHY_NUM 0 #define CONFIG_MII #define CONFIG_BOOTP_DNS #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h index 4efddb620746..0cc0042bca3b 100644 --- a/include/configs/omapl138_lcdk.h +++ b/include/configs/omapl138_lcdk.h @@ -227,7 +227,6 @@ * Network & Ethernet Configuration */ #ifdef CONFIG_DRIVER_TI_EMAC -#define CONFIG_EMAC_MDIO_PHY_NUM 7 #define CONFIG_MII #undef CONFIG_DRIVER_TI_EMAC_USE_RMII #define CONFIG_BOOTP_DEFAULT diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index b1625b779c10..0bdf52eb684a 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -169,7 +169,6 @@ #define CONFIG_DRIVER_TI_EMAC #define CONFIG_DRIVER_TI_EMAC_USE_RMII #define CONFIG_MII -#define CONFIG_EMAC_MDIO_PHY_NUM 0 #define CONFIG_BOOTP_DNS #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index cd0165f9344d..76d2b5a8e8a9 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -776,7 +776,6 @@ CONFIG_EHCI_MMIO_BIG_ENDIAN CONFIG_EHCI_MXS_PORT0 CONFIG_EHCI_MXS_PORT1 CONFIG_ELBC_NAND_SPL_STATIC_PGSIZE -CONFIG_EMAC_MDIO_PHY_NUM CONFIG_EMAC_NR_START CONFIG_EMAC_PHY_MODE CONFIG_EMIF4

On most architectures we do not call print_std_bdinfo() so mark it with __maybe_unused. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com --- cmd/bdinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index ff3cce05f989..41ab8e8089fa 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -157,7 +157,7 @@ static inline void print_baudrate(void) #endif }
-static inline void print_std_bdinfo(const bd_t *bd) +static inline void __maybe_unused print_std_bdinfo(const bd_t *bd) { print_bi_boot_params(bd); print_bi_mem(bd);

On Wed, May 10, 2017 at 03:20:12PM -0400, Tom Rini wrote:
On most architectures we do not call print_std_bdinfo() so mark it with __maybe_unused. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

The function cmd_get_data_size() returns an int and not unsigned. So we should assign it to an int rather than unsigned so that we can later compare the return value. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com --- cmd/io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/io.c b/cmd/io.c index c59148f413cf..ad05f7ca5a32 100644 --- a/cmd/io.c +++ b/cmd/io.c @@ -46,7 +46,8 @@ int do_io_iod(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int do_io_iow(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { - ulong addr, size, val; + ulong addr, val; + int size;
if (argc != 3) return CMD_RET_USAGE;

On Wed, May 10, 2017 at 03:20:13PM -0400, Tom Rini wrote:
The function cmd_get_data_size() returns an int and not unsigned. So we should assign it to an int rather than unsigned so that we can later compare the return value. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

We first check that if argc is less than 2 we return CMD_RET_USAGE. We then see if argc is greater than 2 and if so call get_led_cmd() to set 'cmd' and otherwise set it to LEDST_COUNT (which will always be positive as it's an enum with 0 already assigned). Therefore the test on if cmd is less than 0 will always be false and simply be omitted. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com --- cmd/led.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/cmd/led.c b/cmd/led.c index 84173f86f228..bdfb16c0e098 100644 --- a/cmd/led.c +++ b/cmd/led.c @@ -90,8 +90,6 @@ int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return list_leds();
cmd = argc > 2 ? get_led_cmd(argv[2]) : LEDST_COUNT; - if (cmd < 0) - return CMD_RET_USAGE; #ifdef CONFIG_LED_BLINK if (cmd == LEDST_BLINK) { if (argc < 4)

On Wed, May 10, 2017 at 03:20:14PM -0400, Tom Rini wrote:
We first check that if argc is less than 2 we return CMD_RET_USAGE. We then see if argc is greater than 2 and if so call get_led_cmd() to set 'cmd' and otherwise set it to LEDST_COUNT (which will always be positive as it's an enum with 0 already assigned). Therefore the test on if cmd is less than 0 will always be false and simply be omitted. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.
Cc: Simon Glass sjg@chromium.org Signed-off-by: Tom Rini trini@konsulko.com --- drivers/gpio/gpio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 9ab9df4ce7a6..ba4804083daa 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -68,7 +68,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc) if (numeric != -1) { offset = numeric - uc_priv->gpio_base; /* Allow GPIOs to be numbered from 0 */ - if (offset >= 0 && offset < uc_priv->gpio_count) + if (offset < uc_priv->gpio_count) break; }

On 10 May 2017 at 13:20, Tom Rini trini@konsulko.com wrote:
We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.
Cc: Simon Glass sjg@chromium.org Signed-off-by: Tom Rini trini@konsulko.com
drivers/gpio/gpio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, May 10, 2017 at 03:20:15PM -0400, Tom Rini wrote:
We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.
Cc: Simon Glass sjg@chromium.org Signed-off-by: Tom Rini trini@konsulko.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

In some places we check if part_config is set to MMCPART_NOAVAILABLE (0xff). With part_config being a char this is always false. We should be using a u8 to store this value instead, after a quick consultation with the Linux Kernel. Reported by clang-3.8.
Cc: Jaehoon Chung jh80.chung@samsung.com Signed-off-by: Tom Rini trini@konsulko.com --- include/mmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/mmc.h b/include/mmc.h index fad12d608cef..00576fa3d0a3 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -430,7 +430,7 @@ struct mmc { u8 part_support; u8 part_attr; u8 wr_rel_set; - char part_config; + u8 part_config; uint tran_speed; uint read_bl_len; uint write_bl_len;

Hi Tom,
On 05/11/2017 04:20 AM, Tom Rini wrote:
In some places we check if part_config is set to MMCPART_NOAVAILABLE (0xff). With part_config being a char this is always false. We should be using a u8 to store this value instead, after a quick consultation with the Linux Kernel. Reported by clang-3.8.
Cc: Jaehoon Chung jh80.chung@samsung.com Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot-mmc. Thanks!
include/mmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/mmc.h b/include/mmc.h index fad12d608cef..00576fa3d0a3 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -430,7 +430,7 @@ struct mmc { u8 part_support; u8 part_attr; u8 wr_rel_set;
- char part_config;
- u8 part_config; uint tran_speed; uint read_bl_len; uint write_bl_len;

Inside of max77686_buck_volt2hex/max77686_buck_hex2volt/max77686_ldo_volt2hex we check that the value we calculate is >= 0 however we declare 'hex' as unsigned int making these always true. Mark these as 'int' instead. We also move hex_max to int as they are constants that are 0x3f/0xff. Given that the above functions are marked as returning an int, make the variables we assign their return value to also be int to be able to catch the error condition now. Reported by clang-3.8.
Cc: Jaehoon Chung jh80.chung@samsung.com Signed-off-by: Tom Rini trini@konsulko.com --- drivers/power/regulator/max77686.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index 7479af734ade..5e5815f39789 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -71,8 +71,8 @@ static const char max77686_buck_out[] = {
static int max77686_buck_volt2hex(int buck, int uV) { - unsigned int hex = 0; - unsigned int hex_max = 0; + int hex = 0; + int hex_max = 0;
switch (buck) { case 2: @@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV) static int max77686_buck_hex2volt(int buck, int hex) { unsigned uV = 0; - unsigned int hex_max = 0; + int hex_max = 0;
if (hex < 0) goto bad_hex; @@ -140,7 +140,7 @@ bad_hex:
static int max77686_ldo_volt2hex(int ldo, int uV) { - unsigned int hex = 0; + int hex = 0;
switch (ldo) { case 1: @@ -319,9 +319,9 @@ static int max77686_ldo_modes(int ldo, struct dm_regulator_mode **modesp,
static int max77686_ldo_val(struct udevice *dev, int op, int *uV) { - unsigned int hex, adr; + unsigned int adr; unsigned char val; - int ldo, ret; + int hex, ldo, ret;
if (op == PMIC_OP_GET) *uV = 0; @@ -360,9 +360,9 @@ static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
static int max77686_buck_val(struct udevice *dev, int op, int *uV) { - unsigned int hex, mask, adr; + unsigned int mask, adr; unsigned char val; - int buck, ret; + int hex, buck, ret;
buck = dev->driver_data; if (buck < 1 || buck > MAX77686_BUCK_NUM) {

On 05/11/2017 04:20 AM, Tom Rini wrote:
Inside of max77686_buck_volt2hex/max77686_buck_hex2volt/max77686_ldo_volt2hex we check that the value we calculate is >= 0 however we declare 'hex' as unsigned int making these always true. Mark these as 'int' instead. We also move hex_max to int as they are constants that are 0x3f/0xff. Given that the above functions are marked as returning an int, make the variables we assign their return value to also be int to be able to catch the error condition now. Reported by clang-3.8.
Cc: Jaehoon Chung jh80.chung@samsung.com Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot-mmc for pmic. Thanks.
drivers/power/regulator/max77686.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index 7479af734ade..5e5815f39789 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -71,8 +71,8 @@ static const char max77686_buck_out[] = {
static int max77686_buck_volt2hex(int buck, int uV) {
- unsigned int hex = 0;
- unsigned int hex_max = 0;
int hex = 0;
int hex_max = 0;
switch (buck) { case 2:
@@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV) static int max77686_buck_hex2volt(int buck, int hex) { unsigned uV = 0;
- unsigned int hex_max = 0;
int hex_max = 0;
if (hex < 0) goto bad_hex;
@@ -140,7 +140,7 @@ bad_hex:
static int max77686_ldo_volt2hex(int ldo, int uV) {
- unsigned int hex = 0;
int hex = 0;
switch (ldo) { case 1:
@@ -319,9 +319,9 @@ static int max77686_ldo_modes(int ldo, struct dm_regulator_mode **modesp,
static int max77686_ldo_val(struct udevice *dev, int op, int *uV) {
- unsigned int hex, adr;
- unsigned int adr; unsigned char val;
- int ldo, ret;
int hex, ldo, ret;
if (op == PMIC_OP_GET) *uV = 0;
@@ -360,9 +360,9 @@ static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
static int max77686_buck_val(struct udevice *dev, int op, int *uV) {
- unsigned int hex, mask, adr;
- unsigned int mask, adr; unsigned char val;
- int buck, ret;
int hex, buck, ret;
buck = dev->driver_data; if (buck < 1 || buck > MAX77686_BUCK_NUM) {

The function tpm_xfer returns int so make 'err' be int rather than uint32_t so that we can catch an error condition. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com --- lib/tpm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/tpm.c b/lib/tpm.c index cd7f88f2204e..fb520e3d733c 100644 --- a/lib/tpm.c +++ b/lib/tpm.c @@ -230,10 +230,9 @@ static uint32_t tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr) { struct udevice *dev; - int ret; + int err, ret; uint8_t response_buffer[COMMAND_BUFFER_SIZE]; size_t response_length; - uint32_t err;
if (response) { response_length = *size_ptr;

On Wed, May 10, 2017 at 03:20:18PM -0400, Tom Rini wrote:
The function tpm_xfer returns int so make 'err' be int rather than uint32_t so that we can catch an error condition. Reported by clang-3.8.
Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

On Wed, May 10, 2017 at 03:20:11PM -0400, Tom Rini wrote:
This particular macro hasn't been used in the code for some time, remove these references that were missed.
Signed-off-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!
participants (3)
-
Jaehoon Chung
-
Simon Glass
-
Tom Rini