diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-14 15:52:49 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-14 15:52:49 +0200 |
commit | a80f38d3c59c934897106b79051ce71cf122ad8a (patch) | |
tree | 733b7f0b3d5566174d18b7aa3308c3b6f7c3f63d /drivers | |
parent | 36b901f5a62ff334fb7768aca644fe11f1efbc10 (diff) | |
parent | 83ff1fc386f3585baa5ec6055909588bef4685d5 (diff) | |
download | barebox-a80f38d3c59c934897106b79051ce71cf122ad8a.tar.gz barebox-a80f38d3c59c934897106b79051ce71cf122ad8a.tar.xz |
Merge branch 'for-next/clang-analyze'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 2 | ||||
-rw-r--r-- | drivers/clk/Kconfig | 5 | ||||
-rw-r--r-- | drivers/crypto/caam/jr.c | 2 | ||||
-rw-r--r-- | drivers/mci/mci-core.c | 2 | ||||
-rw-r--r-- | drivers/misc/ubootvar.c | 2 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 2 | ||||
-rw-r--r-- | drivers/nvmem/core.c | 8 | ||||
-rw-r--r-- | drivers/of/fdt.c | 2 | ||||
-rw-r--r-- | drivers/of/overlay.c | 3 | ||||
-rw-r--r-- | drivers/of/partition.c | 3 | ||||
-rw-r--r-- | drivers/phy/phy-core.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_ns16550_pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/dwc2/core.c | 3 | ||||
-rw-r--r-- | drivers/usb/otg/otgdev.c | 33 |
14 files changed, 38 insertions, 33 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index c8422ca46f..7b1501df93 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -46,7 +46,7 @@ static int regmap_mmio_get_min_stride(size_t val_bits) case 8: /* The core treats 0 as 1 */ min_stride = 0; - return 0; + break; case 16: min_stride = 2; break; diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 5b5acf4e06..0faea6488e 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -20,10 +20,11 @@ config CLK_SOCFPGA select COMMON_CLK_OF_PROVIDER default y if ARCH_SOCFPGA && OFDEVICE +if COMMON_CLK config COMMON_CLK_STM32F bool "STM32F4 and STM32F7 clock driver" if COMPILE_TEST - depends on COMMON_CLK && ARCH_STM32 + depends on ARCH_STM32 help Support for stm32f4 and stm32f7 SoC families clocks @@ -38,3 +39,5 @@ config COMMON_CLK_SCMI firmware providing all the clock controls. source "drivers/clk/sifive/Kconfig" + +endif diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 70e016486a..6c48679147 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -289,7 +289,6 @@ static int caam_jr_init(struct device_d *dev) */ int caam_jr_probe(struct device_d *dev) { - struct device_node *nprop; struct caam_job_ring __iomem *ctrl; struct caam_drv_private_jr *jrpriv; static int total_jobrs; @@ -303,7 +302,6 @@ int caam_jr_probe(struct device_d *dev) /* save ring identity relative to detection */ jrpriv->ridx = total_jobrs++; - nprop = dev->device_node; /* Get configuration properties from device tree */ /* First, get register page */ ctrl = dev_get_mem_region(dev, 0); diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 8c08a4f61f..a1e27b9543 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1722,8 +1722,8 @@ static int mci_register_partition(struct mci_part *part) rc = parse_partition_table(&part->blk); if (rc != 0) { + /* Lack of partition table is unusual, but not a failure */ dev_warn(&mci->dev, "No partition table found\n"); - rc = 0; /* it's not a failure */ } if (np) { diff --git a/drivers/misc/ubootvar.c b/drivers/misc/ubootvar.c index d98a6ed9a7..723e9e2b54 100644 --- a/drivers/misc/ubootvar.c +++ b/drivers/misc/ubootvar.c @@ -181,7 +181,7 @@ static int ubootenv_probe(struct device_d *dev) unsigned int crc_ok = 0; int ret, i, current, count = 0; uint32_t crc[2]; - uint8_t flag[2]; + uint8_t flag[2] = { FLAG_NONE, FLAG_NONE }; size_t size[2]; void *blob[2] = { NULL, NULL }; uint8_t *data[2]; diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cf593ee6a6..8a30faa92b 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -554,7 +554,7 @@ static int ksz8873mll_read_status(struct phy_device *phydev) int regval; /* dummy read */ - regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4); + (void)phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4); regval = phy_read(phydev, KSZ8873MLL_GLOBAL_CONTROL_4); diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index fed387c43a..093ea71b95 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -136,7 +136,7 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id) struct nvmem_cell *p; list_for_each_entry(p, &nvmem_cells, node) - if (p && !strcmp(p->name, cell_id)) + if (!strcmp(p->name, cell_id)) return p; return NULL; @@ -591,6 +591,9 @@ static inline void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, /* setup the first byte with lsb bits from nvmem */ rc = nvmem->bus->read(nvmem->priv, cell->offset, &v, 1); + if (IS_ERR_VALUE(rc)) + return ERR_PTR(rc); + *b++ |= GENMASK(bit_offset - 1, 0) & v; /* setup rest of the byte if any */ @@ -609,6 +612,9 @@ static inline void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, /* setup the last byte with msb bits from nvmem */ rc = nvmem->bus->read(nvmem->priv, cell->offset + cell->bytes - 1, &v, 1); + if (IS_ERR_VALUE(rc)) + return ERR_PTR(rc); + *p |= GENMASK(7, (nbits + bit_offset) % BITS_PER_BYTE) & v; } diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 42f45bbd4f..01d7dc3743 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -212,7 +212,7 @@ static struct device_node *__of_unflatten_dtb(const void *infdt, int size, nodep = fdt_prop->data; name = dt_string(&f, dt_strings, fdt32_to_cpu(fdt_prop->nameoff)); - if (!name) { + if (!name || !node) { ret = -ESPIPE; goto err; } diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 20a43f5170..fff1d6ea02 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -418,7 +418,6 @@ void of_overlay_set_basedir(const char *path) static int of_overlay_apply_dir(struct device_node *root, const char *dirname, bool filter) { - char *p, *path; int ret = 0; DIR *dir; @@ -431,8 +430,6 @@ static int of_overlay_apply_dir(struct device_node *root, const char *dirname, if (!dir) return -errno; - p = path = strdup(of_overlay_filepattern); - while (1) { struct dirent *ent; char *filename; diff --git a/drivers/of/partition.c b/drivers/of/partition.c index 6c05e28ea9..abbda674d6 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -31,7 +31,6 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) struct cdev *new; const __be32 *reg; u64 offset, size; - const char *name; int len; unsigned long flags = 0; int na, ns; @@ -60,8 +59,6 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) if (!partname) return NULL; - name = (char *)partname; - debug("add partition: %s.%s 0x%08llx 0x%08llx\n", cdev->name, partname, offset, size); if (of_get_property(node, "read-only", NULL)) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 8a57bd1aa9..3a36f0a1b2 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -169,8 +169,6 @@ int phy_power_on(struct phy *phy) dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); goto out; } - } else { - ret = 0; /* Override possible ret == -ENOTSUPP */ } ++phy->power_count; diff --git a/drivers/serial/serial_ns16550_pci.c b/drivers/serial/serial_ns16550_pci.c index fde8f718dd..0d7b686fef 100644 --- a/drivers/serial/serial_ns16550_pci.c +++ b/drivers/serial/serial_ns16550_pci.c @@ -1203,7 +1203,7 @@ static int pci_quatech_init(struct pci_dev *dev) outl(inl(base + 0x38) | 0x00002000, base + 0x38); tmp = inl(base + 0x3c); outl(tmp | 0x01000000, base + 0x3c); - outl(tmp &= ~0x01000000, base + 0x3c); + outl(tmp & ~0x01000000, base + 0x3c); } } return 0; diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 8be5c91f98..459ebc6537 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -61,6 +61,9 @@ static void dwc2_set_param_phy_type(struct dwc2 *dwc2) case GHWCFG2_HS_PHY_TYPE_ULPI: val = DWC2_PHY_TYPE_PARAM_ULPI; break; + default: + dwc2_warn(dwc2, "Unhandled HS PHY type\n"); + fallthrough; case GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED: val = DWC2_PHY_TYPE_PARAM_FS; break; diff --git a/drivers/usb/otg/otgdev.c b/drivers/usb/otg/otgdev.c index 129b1cf5e1..29cb0d362b 100644 --- a/drivers/usb/otg/otgdev.c +++ b/drivers/usb/otg/otgdev.c @@ -42,6 +42,22 @@ static const char *otg_mode_names[] = { [USB_DR_MODE_OTG] = "otg", }; +static int register_otg_device(struct device_d *dev, struct otg_mode *otg) +{ + struct param_d *param_mode; + int ret; + + ret = register_device(dev); + if (ret) + return ret; + + param_mode = dev_add_param_enum(dev, "mode", + otg_set_mode, NULL, &otg->var_mode, + otg_mode_names, ARRAY_SIZE(otg_mode_names), otg); + + return PTR_ERR_OR_ZERO(param_mode); +} + static struct device_d otg_device = { .name = "otg", .id = DEVICE_ID_SINGLE, @@ -51,7 +67,6 @@ int usb_register_otg_device(struct device_d *parent, int (*set_mode)(void *ctx, enum usb_dr_mode mode), void *ctx) { int ret; - struct param_d *param_mode; struct otg_mode *otg; otg = xzalloc(sizeof(*otg)); @@ -68,22 +83,10 @@ int usb_register_otg_device(struct device_d *parent, /* register otg.mode as an alias of otg0.mode */ if (otg_device.parent == NULL) { otg_device.parent = parent; - ret = register_device(&otg_device); + ret = register_otg_device(&otg_device, otg); if (ret) return ret; - - param_mode = dev_add_param_enum(&otg_device, "mode", - otg_set_mode, NULL, &otg->var_mode, - otg_mode_names, ARRAY_SIZE(otg_mode_names), otg); } - ret = register_device(&otg->dev); - if (ret) - return ret; - - param_mode = dev_add_param_enum(&otg->dev, "mode", - otg_set_mode, NULL, &otg->var_mode, - otg_mode_names, ARRAY_SIZE(otg_mode_names), otg); - - return PTR_ERR_OR_ZERO(param_mode); + return register_otg_device(&otg->dev, otg); } |