dmaengine: ste_dma40: fix unneeded variable warning
Subsystems (7)
Sasha Levin
maintainerPATCH 1/7 dmaengine: ste_dma40: fix unneeded variable warning
From: Arnd Bergmann <[email protected]>
[ Upstream commit 5d6fb560729a5d5554e23db8d00eb57cd0021083 ]
clang-9 points out that there are two variables that depending on the configuration may only be used in an ARRAY_SIZE() expression but not referenced:
drivers/dma/ste_dma40.c:145:12: error: variable 'd40_backup_regs' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static u32 d40_backup_regs[] = {
^drivers/dma/ste_dma40.c:214:12: error: variable 'd40_backup_regs_chan' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static u32 d40_backup_regs_chan[] = {
Mark these __maybe_unused to shut up the warning.
--- drivers/dma/ste_dma40.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ste_dma40.c +2 -2
@@ -142,7 +142,7 @@ enum d40_events {* when the DMA hw is powered off. * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. */ -static u32 d40_backup_regs[] = { +static __maybe_unused u32 d40_backup_regs[] = {D40_DREG_LCPA ,D40_DREG_LCLA ,D40_DREG_PRMSE ,
@@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = {#define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b) -static u32 d40_backup_regs_chan[] = { +static __maybe_unused u32 d40_backup_regs_chan[] = {D40_CHAN_REG_SSCFG ,D40_CHAN_REG_SSELT ,D40_CHAN_REG_SSPTR ,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/7 iommu/dma: Handle SG length overflow better
From: Robin Murphy <[email protected]>
[ Upstream commit ab2cbeb0ed301a9f0460078e91b09f39958212ef ]
Since scatterlist dimensions are all unsigned ints, in the relatively rare cases where a device's max_segment_size is set to UINT_MAX, then the "cur_len + s_length <= max_len" check in __finalise_sg() will always return true. As a result, the corner case of such a device mapping an excessively large scatterlist which is mergeable to or beyond a total length of 4GB can lead to overflow and a bogus truncated dma_length in the resulting segment.
As we already assume that any single segment must be no longer than max_len to begin with, this can easily be addressed by reshuffling the comparison.
--- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/dma-iommu.c +1 -1
@@ -493,7 +493,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,* - and wouldn't make the resulting output segment too long */ if (cur_len && !s_iova_off && (dma_addr & seg_mask) && - (cur_len + s_length <= max_len)) { + (max_len - cur_len >= s_length)) {/* ...then concatenate it with the previous one */ cur_len += s_length; }else {
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 3/7 usb: gadget: composite: Clear "suspended" on reset/disconnect
In reply to Sasha LevinFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit 602fda17c7356bb7ae98467d93549057481d11dd ]
In some cases, one can get out of suspend with a reset or a disconnect followed by a reconnect. Previously we would leave a stale suspended flag set.
--- drivers/usb/gadget/composite.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/composite.c +1 -0
@@ -2000,6 +2000,7 @@ void composite_disconnect(struct usb_gadget *gadget)* disconnect callbacks? */ spin_lock_irqsave (&cdev->lock, flags); + cdev->suspended =0 ;if (cdev->config)reset_config (cdev);if (cdev->driver->disconnect)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/7 xen/blkback: fix memory leaks
In reply to Sasha LevinFrom: Wenwen Wang <[email protected]>
[ Upstream commit ae78ca3cf3d9e9f914bfcd0bc5c389ff18b9c2e0 ]
In read_per_ring_refs(), after 'req' and related memory regions are allocated, xen_blkif_map() is invoked to map the shared frame, irq, and etc. However, if this mapping process fails, no cleanup is performed, leading to memory leaks. To fix this issue, invoke the cleanup before returning the error.
--- drivers/block/xen-blkback/xenbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/xen-blkback/xenbus.c +3 -3
@@ -967,6 +967,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) } blkif->nr_ring_pages = nr_grefs; + err = -ENOMEM ;for (i =0 ; i < nr_grefs *XEN_BLKIF_REQS_PER_PAGE ; i++) { req =kzalloc (sizeof (*req),GFP_KERNEL );if (!req)
@@ -989,7 +990,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) err =xen_blkif_map (ring, ring_ref, nr_grefs, evtchn);if (err) {xenbus_dev_fatal (dev, err,"mapping ring-ref port %u" , evtchn); -return err; + goto fail; }return 0 ;
@@ -1009,8 +1010,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) }kfree (req); } -return -ENOMEM ; - +return err; }static int connect_ring (struct backend_info *be)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/7 i2c: emev2: avoid race when unregistering slave client
In reply to Sasha LevinFrom: Wolfram Sang <[email protected]>
[ Upstream commit d7437fc0d8291181debe032671a289b6bd93f46f ]
After we disabled interrupts, there might still be an active one running. Sync before clearing the pointer to the slave device.
--- drivers/i2c/busses/i2c-emev2.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-emev2.c +12 -4
@@ -72,6 +72,7 @@ struct em_i2c_device {struct completion msg_done;struct clk *sclk;struct i2c_client *slave; +int irq; };static inline void em_clear_set_bit (struct em_i2c_device *priv,u8 clear,u8 set,u8 reg)
@@ -342,6 +343,12 @@ static int em_i2c_unreg_slave(struct i2c_client *slave)writeb (0 , priv->base +I2C_OFS_SVA0 ); +/* +* Wait for interrupt to finish. New slave irqs cannot happen because we +* cleared the slave address and, thus, only extension codes will be +* detected which do not use the slave ptr. +*/ +synchronize_irq (priv->irq); priv->slave =NULL ;return 0 ;
@@ -358,7 +365,7 @@ static int em_i2c_probe(struct platform_device *pdev) {struct em_i2c_device *priv;struct resource *r; -int irq, ret; +int ret; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -391,8 +398,8 @@ static int em_i2c_probe(struct platform_device *pdev)em_i2c_reset (&priv->adap); - irq =platform_get_irq (pdev,0 ); - ret =devm_request_irq (&pdev->dev, irq, em_i2c_irq_handler,0 , + priv->irq =platform_get_irq (pdev,0 ); + ret =devm_request_irq (&pdev->dev, priv->irq, em_i2c_irq_handler,0 ,"em_i2c" , priv);if (ret) goto err_clk;
@@ -402,7 +409,8 @@ static int em_i2c_probe(struct platform_device *pdev)if (ret) goto err_clk; -dev_info (&pdev->dev,"Added i2c controller %d, irq %d\n" , priv->adap.nr, irq); +dev_info (&pdev->dev,"Added i2c controller %d, irq %d\n" , priv->adap.nr, + priv->irq);return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/7 usb: host: fotg2: restart hcd after port reset
In reply to Sasha LevinFrom: Hans Ulli Kroll <[email protected]>
[ Upstream commit 777758888ffe59ef754cc39ab2f275dc277732f4 ]
On the Gemini SoC the FOTG2 stalls after port reset so restart the HCD after each port reset.
--- drivers/usb/host/fotg210-hcd.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/fotg210-hcd.c +4 -0
@@ -1653,6 +1653,10 @@ static int fotg210_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,/* see what we found out */ temp =check_reset_complete (fotg210, wIndex, status_reg,fotg210_readl (fotg210, status_reg)); + +/* restart schedule */ + fotg210->command |=CMD_RUN ; +fotg210_writel (fotg210, fotg210->command, &fotg210->regs->command); }if (!(temp & (PORT_RESUME |PORT_RESET ))) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/7 tools: hv: fix KVP and VSS daemons exit code
In reply to Sasha LevinFrom: Adrian Vladu <[email protected]>
[ Upstream commit b0995156071b0ff29a5902964a9dc8cfad6f81c0 ]
HyperV KVP and VSS daemons should exit with 0 when the '--help' or '-h' flags are used.
--- tools/hv/hv_kvp_daemon.c | 2 ++ tools/hv/hv_vss_daemon.c | 2 ++ 2 files changed, 4 insertions(+)
tools/hv/hv_kvp_daemon.c +2 -0
@@ -1379,6 +1379,8 @@ int main(int argc, char *argv[]) daemonize =0 ;break ;case 'h' : +print_usage (argv); +exit (0 );default :print_usage (argv);exit (EXIT_FAILURE );
tools/hv/hv_vss_daemon.c +2 -0
@@ -164,6 +164,8 @@ int main(int argc, char *argv[]) daemonize =0 ;break ;case 'h' : +print_usage (argv); +exit (0 );default :print_usage (argv);exit (EXIT_FAILURE );
Signature · 1 line
2.20.1