Re: [PATCH v2] scsi: libsas: Reset num_scatter if libata mark qc as NODATA
在 2021/3/19 6:56, Jolly Shah 写道: When the cache_type for the scsi device is changed, the scsi layer issues a MODE_SELECT command. The caching mode details are communicated via a request buffer associated with the scsi command with data direction set as DMA_TO_DEVICE (scsi_mode_select). When this command reaches the libata layer, as a part of generic initial setup, libata layer sets up the scatterlist for the command using the scsi command (ata_scsi_qc_new). This command is then translated by the libata layer into ATA_CMD_SET_FEATURES (ata_scsi_mode_select_xlat). The libata layer treats this as a non data command (ata_mselect_caching), since it only needs an ata taskfile to pass the caching on/off information to the device. It does not need the scatterlist that has been setup, so it does not perform dma_map_sg on the scatterlist (ata_qc_issue). Unfortunately, when this command reaches the libsas layer(sas_ata_qc_issue), libsas layer sees it as a non data command with a scatterlist. It cannot extract the correct dma length, since the scatterlist has not been mapped with dma_map_sg for a DMA operation. When this partially constructed SAS task reaches pm80xx LLDD, it results in below warning. "pm80xx_chip_sata_req 6058: The sg list address start_addr=0x data_len=0x0end_addr_high=0x end_addr_low=0x has crossed 4G boundary" This patch updates code to handle ata non data commands separately so num_scatter and total_xfer_len remain 0. Fixes: 53de092f47ff ("scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA") Signed-off-by: Jolly Shah --- v2: - reorganized code to avoid setting num_scatter twice drivers/scsi/libsas/sas_ata.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 024e5a550759..8b9a39077dba 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -201,18 +201,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; + task->data_dir = qc->dma_dir; + } else if (qc->tf.protocol == ATA_PROT_NODATA) { + task->data_dir = DMA_NONE; Hi Jolly & John, We only set DMA_NONE for ATA_PROT_NODATA, I'm curious about why ATA_PROT_NCQ_NODATA and ATAPI_PROT_NODATA do not need to set DMA_NONE? Thanks, Jason } else { for_each_sg(qc->sg, sg, qc->n_elem, si) xfer += sg_dma_len(sg); task->total_xfer_len = xfer; task->num_scatter = si; - } - - if (qc->tf.protocol == ATA_PROT_NODATA) - task->data_dir = DMA_NONE; - else task->data_dir = qc->dma_dir; + } task->scatter = qc->sg; task->ata_task.retry_count = 1; task->task_state_flags = SAS_TASK_STATE_PENDING;
Re: [PATCH] scsi: libsas: Reset num_scatter if libata mark qc as NODATA
在 2021/3/17 3:39, Jolly Shah 写道: When the cache_type for the scsi device is changed, the scsi layer issues a MODE_SELECT command. The caching mode details are communicated via a request buffer associated with the scsi command with data direction set as DMA_TO_DEVICE (scsi_mode_select). When this command reaches the libata layer, as a part of generic initial setup, libata layer sets up the scatterlist for the command using the scsi command (ata_scsi_qc_new). This command is then translated by the libata layer into ATA_CMD_SET_FEATURES (ata_scsi_mode_select_xlat). The libata layer treats this as a non data command (ata_mselect_caching), since it only needs an ata taskfile to pass the caching on/off information to the device. It does not need the scatterlist that has been setup, so it does not perform dma_map_sg on the scatterlist (ata_qc_issue). Unfortunately, when this command reaches the libsas layer(sas_ata_qc_issue), libsas layer sees it as a non data command with a scatterlist. It cannot extract the correct dma length, since the scatterlist has not been mapped with dma_map_sg for a DMA operation. When this partially constructed SAS task reaches pm80xx LLDD, it results in below warning. "pm80xx_chip_sata_req 6058: The sg list address start_addr=0x data_len=0x0end_addr_high=0x end_addr_low=0x has crossed 4G boundary" This patch assigns appropriate value to num_sectors for ata non data commands. Signed-off-by: Jolly Shah --- drivers/scsi/libsas/sas_ata.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 024e5a550759..94ec08cebbaa 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -209,10 +209,12 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->num_scatter = si; } - if (qc->tf.protocol == ATA_PROT_NODATA) + if (qc->tf.protocol == ATA_PROT_NODATA) { task->data_dir = DMA_NONE; - else + task->num_scatter = 0; + } else { task->data_dir = qc->dma_dir; + } task->scatter = qc->sg; task->ata_task.retry_count = 1; task->task_state_flags = SAS_TASK_STATE_PENDING; Thanks for the patch. Except the warning, any functional errors? The code looks good to me, Reviewed-by: Jason Yan
Re: [PATCH 00/11] scsi: libsas: Remove in_interrupt() check
在 2020/12/21 18:13, John Garry 写道: On 18/12/2020 20:43, Ahmed S. Darwish wrote: Folks, In the discussion about preempt count consistency across kernel configurations: https://lkml.kernel.org/r/20200914204209.256266...@linutronix.de it was concluded that the usage of in_interrupt() and related context checks should be removed from non-core code. This includes memory allocation mode decisions (GFP_*). In the long run, usage of in_interrupt() and its siblings should be banned from driver code completely. This series addresses SCSI libsas. Basically, the function: => drivers/scsi/libsas/sas_init.c: struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy) { ... gfp_t flags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; event = kmem_cache_zalloc(sas_event_cache, flags); Hi Ahmed, Firstly I would say that it would be nice to just remove all the atomic context calls. But that may require significant LLDD rework and participation from driver stakeholders. However, considering function sas_alloc_event() again: gfp_t flags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; ... event = kmem_cache_zalloc(sas_event_cache, flags); if (!event) return NULL; atomic_inc(>event_nr); if (atomic_read(>event_nr) > phy->ha->event_thres) { /* Code to shutdown the phy */ } return event; So default for phy->ha->event_thres is 32, and I can't imagine that The default value is 1024. anyone has ever reconfigured this via sysfs or even required a value that large. Maybe Jason (cc'ed) knows better. It's an arbitrary value to say that the PHY is malfunctioning. I do note that there is the circular path sas_alloc_event() -> sas_notify_phy_event() -> sas_alloc_event() there also. Anyway, if the 32x event memories were per-allocated, maybe there is a clean method to manage this memory, which even works in atomic context, so we could avoid this rework (ignoring the context bugs you reported for a moment). I do also note that the sas_event_cache size is not huge. Pre-allocated memory is an option.(Which we have tried at the very beginnig by Wang Yijing.) Or directly use GFP_ATOMIC is maybe better than passing flags from lldds. Thanks, Jason Anyway, I'll look at the rest of the series. Thanks, John ... } is transformed so that callers explicitly pass the gfp_t memory allocation flags. Affected libsas clients are modified accordingly. The first six patches have "Fixes: " tags and address bugs the were noticed during the context analysis. Thanks! 8<-- Ahmed S. Darwish (11): Documentation: scsi: libsas: Remove notify_ha_event() scsi: libsas: Introduce a _gfp() variant of event notifiers scsi: mvsas: Pass gfp_t flags to libsas event notifiers scsi: isci: port: link down: Pass gfp_t flags scsi: isci: port: link up: Pass gfp_t flags scsi: isci: port: broadcast change: Pass gfp_t flags scsi: libsas: Pass gfp_t flags to event notifiers scsi: pm80xx: Pass gfp_t flags to libsas event notifiers scsi: aic94xx: Pass gfp_t flags to libsas event notifiers scsi: hisi_sas: Pass gfp_t flags to libsas event notifiers scsi: libsas: event notifiers: Remove non _gfp() variants Documentation/scsi/libsas.rst | 5 ++-- drivers/scsi/aic94xx/aic94xx_scb.c | 18 ++-- drivers/scsi/hisi_sas/hisi_sas.h | 3 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 26 ++ drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 5 ++-- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 ++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 ++-- drivers/scsi/isci/port.c | 14 ++ drivers/scsi/libsas/sas_event.c | 21 -- drivers/scsi/libsas/sas_init.c | 11 drivers/scsi/libsas/sas_internal.h | 4 +-- drivers/scsi/mvsas/mv_sas.c | 22 +++ drivers/scsi/pm8001/pm8001_hwi.c | 38 +- drivers/scsi/pm8001/pm8001_sas.c | 8 +++--- drivers/scsi/pm8001/pm80xx_hwi.c | 30 ++-- include/scsi/libsas.h | 4 +-- 16 files changed, 116 insertions(+), 103 deletions(-) base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442 -- 2.29.2 . .
[PATCH] lib/lzo: make lzogeneric1x_1_compress() static
Fix the following sparse warning: lib/lzo/lzo1x_compress.c:304:5: warning: symbol 'lzogeneric1x_1_compress' was not declared. Should it be static? Signed-off-by: Jason Yan --- lib/lzo/lzo1x_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lzo/lzo1x_compress.c b/lib/lzo/lzo1x_compress.c index 8ad5ba2b86e2..76758e9296ba 100644 --- a/lib/lzo/lzo1x_compress.c +++ b/lib/lzo/lzo1x_compress.c @@ -301,7 +301,7 @@ lzo1x_1_do_compress(const unsigned char *in, size_t in_len, return in_end - (ii - ti); } -int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, +static int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len, void *wrkmem, const unsigned char bitstream_version) { -- 2.25.4
Re: [PATCH -next] scsi: libsas: simplify the return expression of sas_discover_* functions
在 2020/9/21 21:45, Liu Shixin 写道: Simplify the return expression. Signed-off-by: Liu Shixin --- drivers/scsi/libsas/sas_ata.c | 8 +--- drivers/scsi/libsas/sas_discover.c | 8 +--- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index a4887985aad6..024e5a550759 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -726,19 +726,13 @@ void sas_resume_sata(struct asd_sas_port *port) */ int sas_discover_sata(struct domain_device *dev) { - int res; - if (dev->dev_type == SAS_SATA_PM) return -ENODEV; dev->sata_dev.class = sas_get_ata_command_set(dev); sas_fill_in_rphy(dev, dev->rphy); - res = sas_notify_lldd_dev_found(dev); - if (res) - return res; - - return 0; + return sas_notify_lldd_dev_found(dev); } static void async_sas_ata_eh(void *data, async_cookie_t cookie) diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index d0f9e90e3279..161c9b387da7 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -278,13 +278,7 @@ static void sas_resume_devices(struct work_struct *work) */ int sas_discover_end_dev(struct domain_device *dev) { - int res; - - res = sas_notify_lldd_dev_found(dev); - if (res) - return res; - - return 0; + return sas_notify_lldd_dev_found(dev); } /* -- Device registration and unregistration -- */ Please add a version descriptor and describe the change against the first version next time . Otherwise this looks good to me. Reviewed-by: Jason Yan Thanks, Jason
[PATCH] bootconfig: init: make xbc_namebuf static
This eliminates the following sparse warning: init/main.c:306:6: warning: symbol 'xbc_namebuf' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan --- init/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c index 92773a5daf8d..5ac07eb4a300 100644 --- a/init/main.c +++ b/init/main.c @@ -303,7 +303,7 @@ static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum) #ifdef CONFIG_BOOT_CONFIG -char xbc_namebuf[XBC_KEYLEN_MAX] __initdata; +static char xbc_namebuf[XBC_KEYLEN_MAX] __initdata; #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0) -- 2.25.4
[PATCH] powerpc/ps3: make two symbols static
This addresses the following sparse warning: arch/powerpc/platforms/ps3/spu.c:451:33: warning: symbol 'spu_management_ps3_ops' was not declared. Should it be static? arch/powerpc/platforms/ps3/spu.c:592:28: warning: symbol 'spu_priv1_ps3_ops' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan --- arch/powerpc/platforms/ps3/spu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c index 1193c294b8d0..0c252478e556 100644 --- a/arch/powerpc/platforms/ps3/spu.c +++ b/arch/powerpc/platforms/ps3/spu.c @@ -448,7 +448,7 @@ static void ps3_disable_spu(struct spu_context *ctx) ctx->ops->runcntl_stop(ctx); } -const struct spu_management_ops spu_management_ps3_ops = { +static const struct spu_management_ops spu_management_ps3_ops = { .enumerate_spus = ps3_enumerate_spus, .create_spu = ps3_create_spu, .destroy_spu = ps3_destroy_spu, @@ -589,7 +589,7 @@ static u64 resource_allocation_enable_get(struct spu *spu) return 0; /* No support. */ } -const struct spu_priv1_ops spu_priv1_ps3_ops = { +static const struct spu_priv1_ops spu_priv1_ps3_ops = { .int_mask_and = int_mask_and, .int_mask_or = int_mask_or, .int_mask_set = int_mask_set, -- 2.25.4
[PATCH] MIPS: Make setup_elfcorehdr and setup_elfcorehdr_size static
This addresses the following sparse warning: arch/mips/kernel/setup.c:446:33: warning: symbol 'setup_elfcorehdr_size' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan --- arch/mips/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 335bd188b8b4..c004a311aaab 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -443,7 +443,7 @@ static int __init early_parse_memmap(char *p) early_param("memmap", early_parse_memmap); #ifdef CONFIG_PROC_VMCORE -unsigned long setup_elfcorehdr, setup_elfcorehdr_size; +static unsigned long setup_elfcorehdr, setup_elfcorehdr_size; static int __init early_parse_elfcorehdr(char *p) { phys_addr_t start, end; -- 2.25.4
[PATCH] clk: qcom: gcc-msm8939: remove defined but not used variables
This addresses the following gcc warning with "make W=1": drivers/clk/qcom/gcc-msm8939.c:610:32: warning: ‘gcc_xo_gpll6_gpll0a_map’ defined but not used [-Wunused-const-variable=] static const struct parent_map gcc_xo_gpll6_gpll0a_map[] = { ^~~ drivers/clk/qcom/gcc-msm8939.c:598:32: warning: ‘gcc_xo_gpll6_gpll0_map’ defined but not used [-Wunused-const-variable=] static const struct parent_map gcc_xo_gpll6_gpll0_map[] = { ^~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/clk/qcom/gcc-msm8939.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 778354f82b1e..39ebb443ae3d 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -595,24 +595,12 @@ static const struct clk_parent_data gcc_xo_gpll1_emclk_sleep_parent_data[] = { { .fw_name = "sleep_clk", .name = "sleep_clk" }, }; -static const struct parent_map gcc_xo_gpll6_gpll0_map[] = { - { P_XO, 0 }, - { P_GPLL6, 1 }, - { P_GPLL0, 2 }, -}; - static const struct clk_parent_data gcc_xo_gpll6_gpll0_parent_data[] = { { .fw_name = "xo" }, { .hw = _vote.hw }, { .hw = _vote.hw }, }; -static const struct parent_map gcc_xo_gpll6_gpll0a_map[] = { - { P_XO, 0 }, - { P_GPLL6, 1 }, - { P_GPLL0_AUX, 2 }, -}; - static const struct clk_parent_data gcc_xo_gpll6_gpll0a_parent_data[] = { { .fw_name = "xo" }, { .hw = _vote.hw }, -- 2.25.4
[PATCH] drm/i810: make i810_flush_queue() return void
This function always return '0' and no callers use the return value. So make it a void function. This eliminates the following coccicheck warning: drivers/gpu/drm/i810/i810_dma.c:860:8-11: Unneeded variable: "ret". Return "0" on line 885 Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/gpu/drm/i810/i810_dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 303c2d483c6e..88250860f8e4 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c @@ -853,11 +853,11 @@ static void i810_dma_quiescent(struct drm_device *dev) i810_wait_ring(dev, dev_priv->ring.Size - 8); } -static int i810_flush_queue(struct drm_device *dev) +static void i810_flush_queue(struct drm_device *dev) { drm_i810_private_t *dev_priv = dev->dev_private; struct drm_device_dma *dma = dev->dma; - int i, ret = 0; + int i; RING_LOCALS; i810_kernel_lost_context(dev); @@ -882,7 +882,7 @@ static int i810_flush_queue(struct drm_device *dev) DRM_DEBUG("still on client\n"); } - return ret; + return; } /* Must be called with the lock held */ -- 2.25.4
[PATCH] soc: sunxi: sram: remove unneeded semicolon
Eliminate the following coccicheck warning: drivers/soc/sunxi/sunxi_sram.c:197:2-3: Unneeded semicolon Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/soc/sunxi/sunxi_sram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 1b0d50f36349..d4c7bd59429e 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -194,7 +194,7 @@ static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *nod if (!data) { ret = -EINVAL; goto err; - }; + } for (func = data->func; func->func; func++) { if (val == func->val) { -- 2.25.4
[PATCH] pcmcia: db1xxx_ss: remove unneeded semicolon
Eliminate the following coccicheck warning: drivers/pcmcia/db1xxx_ss.c:455:2-3: Unneeded semicolon Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/pcmcia/db1xxx_ss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c index a7c7c7cd2326..a6fbc709913e 100644 --- a/drivers/pcmcia/db1xxx_ss.c +++ b/drivers/pcmcia/db1xxx_ss.c @@ -452,7 +452,7 @@ static int db1x_pcmcia_socket_probe(struct platform_device *pdev) printk(KERN_INFO "db1xxx-ss: unknown board %d!\n", bid); ret = -ENODEV; goto out0; - }; + } /* * gather resources necessary and optional nice-to-haves to -- 2.25.4
[PATCH] video: fbdev: fsl-diu-fb: remove unneeded variable 'res'
Eliminate the following coccicheck warning: drivers/video/fbdev/fsl-diu-fb.c:1428:5-8: Unneeded variable: "res". Return "0" on line 1450 Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/video/fbdev/fsl-diu-fb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index a547c21c7e92..e332017c6af6 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -1425,7 +1425,6 @@ static int fsl_diu_open(struct fb_info *info, int user) static int fsl_diu_release(struct fb_info *info, int user) { struct mfb_info *mfbi = info->par; - int res = 0; spin_lock(_lock); mfbi->count--; @@ -1447,7 +1446,7 @@ static int fsl_diu_release(struct fb_info *info, int user) } spin_unlock(_lock); - return res; + return 0; } static const struct fb_ops fsl_diu_ops = { -- 2.25.4
[PATCH] drm: xlnx: remove defined but not used 'scaling_factors_666'
This addresses the following gcc warning with "make W=1": drivers/gpu/drm/xlnx/zynqmp_disp.c:245:18: warning: ‘scaling_factors_666’ defined but not used [-Wunused-const-variable=] 245 | static const u32 scaling_factors_666[] = { | ^~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index a455cfc1bee5..98bd48f13fd1 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -242,12 +242,6 @@ static const u32 scaling_factors_565[] = { ZYNQMP_DISP_AV_BUF_5BIT_SF, }; -static const u32 scaling_factors_666[] = { - ZYNQMP_DISP_AV_BUF_6BIT_SF, - ZYNQMP_DISP_AV_BUF_6BIT_SF, - ZYNQMP_DISP_AV_BUF_6BIT_SF, -}; - static const u32 scaling_factors_888[] = { ZYNQMP_DISP_AV_BUF_8BIT_SF, ZYNQMP_DISP_AV_BUF_8BIT_SF, -- 2.25.4
[PATCH] brcmsmac: phytbl_lcn: Eliminate defined but not used 'dot11lcn_gain_tbl_rev1'
This addresses the following gcc warning with "make W=1": drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c:108:18: warning: ‘dot11lcn_gain_tbl_rev1’ defined but not used [-Wunused-const-variable=] 108 | static const u32 dot11lcn_gain_tbl_rev1[] = { | ^~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- .../brcm80211/brcmsmac/phy/phytbl_lcn.c | 99 --- 1 file changed, 99 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c index 7526aa441de1..5331b5468e14 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c @@ -105,105 +105,6 @@ static const u32 dot11lcn_gain_tbl_rev0[] = { 0x, }; -static const u32 dot11lcn_gain_tbl_rev1[] = { - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x0008, - 0x0004, - 0x0008, - 0x0001, - 0x0005, - 0x0009, - 0x000D, - 0x0011, - 0x0051, - 0x0091, - 0x0011, - 0x0051, - 0x0091, - 0x00d1, - 0x0053, - 0x0093, - 0x00d3, - 0x00d7, - 0x0117, - 0x0517, - 0x0917, - 0x0957, - 0x0d57, - 0x1157, - 0x1197, - 0x5197, - 0x9197, - 0xd197, - 0x00011197, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x0008, - 0x0004, - 0x0008, - 0x0001, - 0x0005, - 0x0009, - 0x000D, - 0x0011, - 0x0051, - 0x0091, - 0x0011, - 0x0051, - 0x0091, - 0x00d1, - 0x0053, - 0x0093, - 0x00d3, - 0x00d7, - 0x0117, - 0x0517, - 0x0917, - 0x0957, - 0x0d57, - 0x1157, - 0x5157, - 0x9157, - 0xd157, - 0x00011157, - 0x00015157, - 0x00019157, - 0x0001d157, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, - 0x, -}; - static const u16 dot11lcn_aux_gain_idx_tbl_rev0[] = { 0x0401, 0x0402, -- 2.25.4
[PATCH] video: fbdev: sis: remove unneeded semicolon
Eliminate the following coccicheck warning: drivers/video/fbdev/sis/sis_accel.h:143:72-73: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:144:72-73: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:145:72-73: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:273:75-76: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:274:75-76: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:275:73-74: Unneeded semicolon drivers/video/fbdev/sis/sis_accel.h:276:75-76: Unneeded semicolon Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/video/fbdev/sis/sis_accel.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/sis/sis_accel.h b/drivers/video/fbdev/sis/sis_accel.h index c3dfd2a20cf9..98d209658662 100644 --- a/drivers/video/fbdev/sis/sis_accel.h +++ b/drivers/video/fbdev/sis/sis_accel.h @@ -140,9 +140,9 @@ #define SiS300Idle \ { \ - while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ - while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ - while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){} \ + while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){} \ + while((MMIO_IN16(ivideo->mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){} \ CmdQueLen = MMIO_IN16(ivideo->mmio_vbase, 0x8240); \ } /* (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ @@ -270,10 +270,10 @@ #define SiS310Idle \ { \ - while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ - while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ - while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ - while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){} \ + while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){} \ + while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){} \ + while( (MMIO_IN16(ivideo->mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){} \ CmdQueLen = 0; \ } -- 2.25.4
[PATCH] brcmsmac: phy_lcn: Eliminate defined but not used 'lcnphy_rx_iqcomp_table_rev0'
This addresses the following gcc warning with "make W=1": drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:361:25: warning: ‘lcnphy_rx_iqcomp_table_rev0’ defined but not used [-Wunused-const-variable=] 361 | struct lcnphy_rx_iqcomp lcnphy_rx_iqcomp_table_rev0[] = { | ^~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- .../broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 55 --- 1 file changed, 55 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c index b8193c99e864..7071b63042cd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c @@ -357,61 +357,6 @@ u16 rxiq_cal_rf_reg[11] = { RADIO_2064_REG12A, }; -static const -struct lcnphy_rx_iqcomp lcnphy_rx_iqcomp_table_rev0[] = { - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {34, 0, 0}, - {38, 0, 0}, - {42, 0, 0}, - {46, 0, 0}, - {36, 0, 0}, - {40, 0, 0}, - {44, 0, 0}, - {48, 0, 0}, - {52, 0, 0}, - {56, 0, 0}, - {60, 0, 0}, - {64, 0, 0}, - {100, 0, 0}, - {104, 0, 0}, - {108, 0, 0}, - {112, 0, 0}, - {116, 0, 0}, - {120, 0, 0}, - {124, 0, 0}, - {128, 0, 0}, - {132, 0, 0}, - {136, 0, 0}, - {140, 0, 0}, - {149, 0, 0}, - {153, 0, 0}, - {157, 0, 0}, - {161, 0, 0}, - {165, 0, 0}, - {184, 0, 0}, - {188, 0, 0}, - {192, 0, 0}, - {196, 0, 0}, - {200, 0, 0}, - {204, 0, 0}, - {208, 0, 0}, - {212, 0, 0}, - {216, 0, 0}, -}; - static const u32 lcnphy_23bitgaincode_table[] = { 0x200100, 0x200200, -- 2.25.4
[PATCH] brcmsmac: main: Eliminate empty brcms_c_down_del_timer()
This function does nothing so remove it. This addresses the following coccicheck warning: drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c:5103:6-15: Unneeded variable: "callbacks". Return "0" on line 5105 Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c index 21691581b532..763e0ec583d7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c @@ -5085,13 +5085,6 @@ int brcms_c_up(struct brcms_c_info *wlc) return 0; } -static uint brcms_c_down_del_timer(struct brcms_c_info *wlc) -{ - uint callbacks = 0; - - return callbacks; -} - static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) { bool dev_gone; @@ -5201,8 +5194,6 @@ uint brcms_c_down(struct brcms_c_info *wlc) callbacks++; wlc->WDarmed = false; } - /* cancel all other timers */ - callbacks += brcms_c_down_del_timer(wlc); wlc->pub->up = false; -- 2.25.4
[PATCH] soc: fsl: dpio: remove set but not used 'addr_cena'
This addresses the following gcc warning with "make W=1": drivers/soc/fsl/dpio/qbman-portal.c: In function ‘qbman_swp_enqueue_multiple_direct’: drivers/soc/fsl/dpio/qbman-portal.c:650:11: warning: variable ‘addr_cena’ set but not used [-Wunused-but-set-variable] 650 | uint64_t addr_cena; | ^ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/soc/fsl/dpio/qbman-portal.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c index 0ab85bfb116f..659b4a570d5b 100644 --- a/drivers/soc/fsl/dpio/qbman-portal.c +++ b/drivers/soc/fsl/dpio/qbman-portal.c @@ -647,7 +647,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s, const uint32_t *cl = (uint32_t *)d; uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; int i, num_enqueued = 0; - uint64_t addr_cena; spin_lock(>access_spinlock); half_mask = (s->eqcr.pi_ci_mask>>1); @@ -701,7 +700,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s, /* Flush all the cacheline without load/store in between */ eqcr_pi = s->eqcr.pi; - addr_cena = (size_t)s->addr_cena; for (i = 0; i < num_enqueued; i++) eqcr_pi++; s->eqcr.pi = eqcr_pi & full_mask; -- 2.25.4
Re: [PATCH] scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
在 2020/9/5 20:58, Dan Carpenter 写道: In sas_notify_lldd_dev_found(), if we can't find a device, then it seems like the wrong thing to mark the device as found and to increment the reference count. None of the callers ever drop the reference in that situation. Fixes: 735f7d2fedf5 ("[SCSI] libsas: fix domain_device leak") Signed-off-by: Dan Carpenter --- drivers/scsi/libsas/sas_discover.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index cd7c7d269f6f..d0f9e90e3279 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -182,10 +182,11 @@ int sas_notify_lldd_dev_found(struct domain_device *dev) pr_warn("driver on host %s cannot handle device %016llx, error:%d\n", dev_name(sas_ha->dev), SAS_ADDR(dev->sas_addr), res); + return res; } set_bit(SAS_DEV_FOUND, >state); kref_get(>kref); - return res; + return 0; } Hi Dan, thanks for finding this, Reviewed-by: Jason Yan
[PATCH] ath6kl: wmi: remove set but not used 'rate'
This addresses the following gcc warning with "make W=1": drivers/net/wireless/ath/ath6kl/wmi.c: In function ‘ath6kl_wmi_bitrate_reply_rx’: drivers/net/wireless/ath/ath6kl/wmi.c:1204:6: warning: variable ‘rate’ set but not used [-Wunused-but-set-variable] 1204 | s32 rate; | ^~~~ The variable 'sgi' is alse removed because after 'rate' is removed, it is not used too. Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/net/wireless/ath/ath6kl/wmi.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 6885d2ded53a..a4339cca661f 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -1201,8 +1201,7 @@ static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap, static int ath6kl_wmi_bitrate_reply_rx(struct wmi *wmi, u8 *datap, int len) { struct wmi_bit_rate_reply *reply; - s32 rate; - u32 sgi, index; + u32 index; if (len < sizeof(struct wmi_bit_rate_reply)) return -EINVAL; @@ -1211,15 +1210,10 @@ static int ath6kl_wmi_bitrate_reply_rx(struct wmi *wmi, u8 *datap, int len) ath6kl_dbg(ATH6KL_DBG_WMI, "rateindex %d\n", reply->rate_index); - if (reply->rate_index == (s8) RATE_AUTO) { - rate = RATE_AUTO; - } else { + if (reply->rate_index != (s8) RATE_AUTO) { index = reply->rate_index & 0x7f; if (WARN_ON_ONCE(index > (RATE_MCS_7_40 + 1))) return -EINVAL; - - sgi = (reply->rate_index & 0x80) ? 1 : 0; - rate = wmi_rate_tbl[index][sgi]; } ath6kl_wakeup_event(wmi->parent_dev); -- 2.25.4
Re: [PATCH v1] scsi: libsas: set data_dir as DMA_NONE if libata mark qc as NODATA
在 2020/8/26 15:24, Luo Jiaxing 写道: We found that it will fail every time when set feature to SATA disk by "sdparm -s WCE=0 /dev/sde". After checking protocol, we know that MODE SELECT is the SCSI command for setting WCE, and it do not exist in the SATA protocol. Therefore, this commands are encapsulated in the SET FEATURE command in SATA protocol. The difference is that the MODE SELECT command sent to SAS disk contains data and is sent through the DMA. But when send to SATA disk through SET FEATURE command, it does not contain data. I think libsas was not thorough enough in dealing with the situation, at sas_ata_qc_issue(), task->dma_dir is inherited from qc->dma_dir(qc->dma_dir is also inherited from SCSI). However, in ATA driver, if qc->tf.protocol is set to ATA_PROT_NODATA, ata_sg_setup() will not invoked by ata_qc_issue(). It mean that ATA didn't use dma_dir and it's not reliable. So, if libsas still inherits from qc->dma_dir when there is no data need to be send. As a result, task with no data are mistakenly considered as carrying data and it will make LLDD report an error on IO completion. So, When ATA driver mark tf->protocol as NODATA, dma_dir should be set as DMA_NONE. And we can see WCE is successfully disable for SATA disk then. Euler:~ # sdparm -s WCE=0 /dev/sde /dev/sde: ATA ST4000NM0035-1V4 TN03 Euler:~ # sdparm /dev/sde /dev/sde: ATA ST4000NM0035-1V4 TN03 Read write error recovery mode page: AWRE1 [cha: n, def: 1] ARRE0 [cha: n, def: 0] PER 0 [cha: n, def: 0] Caching (SBC) mode page: WCE 0 [cha: y, def: 0] RCD 0 [cha: n, def: 0] Control mode page: SWP 0 [cha: n, def: 0] Fixes: fa1c1e8f1ece ("[SCSI] Add SATA support to libsas") Signed-off-by: Luo Jiaxing Reviewed-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 6a521ba..a488798 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -209,7 +209,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->num_scatter = si; } - task->data_dir = qc->dma_dir; + if (qc->tf.protocol == ATA_PROT_NODATA) + task->data_dir = DMA_NONE; + else + task->data_dir = qc->dma_dir; task->scatter = qc->sg; task->ata_task.retry_count = 1; task->task_state_flags = SAS_TASK_STATE_PENDING; Reviewed-by: Jason Yan
[PATCH] video: fbdev: remove set but not used 'ulBestVCO'
This addresses the following gcc warning with "make W=1": drivers/video/fbdev/kyro/STG4000InitDevice.c: In function ‘ProgramClock’: drivers/video/fbdev/kyro/STG4000InitDevice.c:123:6: warning: variable ‘ulBestVCO’ set but not used [-Wunused-but-set-variable] 123 | u32 ulBestVCO = 0, ulBestClk = 0, ulBestScore = 0; | ^ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/video/fbdev/kyro/STG4000InitDevice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/video/fbdev/kyro/STG4000InitDevice.c b/drivers/video/fbdev/kyro/STG4000InitDevice.c index edaeec2d9590..21875d3c2dc2 100644 --- a/drivers/video/fbdev/kyro/STG4000InitDevice.c +++ b/drivers/video/fbdev/kyro/STG4000InitDevice.c @@ -120,7 +120,7 @@ u32 ProgramClock(u32 refClock, { u32 R = 0, F = 0, OD = 0, ODIndex = 0; u32 ulBestR = 0, ulBestF = 0, ulBestOD = 0; - u32 ulBestVCO = 0, ulBestClk = 0, ulBestScore = 0; + u32 ulBestClk = 0, ulBestScore = 0; u32 ulScore, ulPhaseScore, ulVcoScore; u32 ulTmp = 0, ulVCO; u32 ulScaleClockReq, ulMinClock, ulMaxClock; @@ -189,7 +189,6 @@ u32 ProgramClock(u32 refClock, ulScore = ulPhaseScore + ulVcoScore; if (!ulBestScore) { - ulBestVCO = ulVCO; ulBestOD = OD; ulBestF = F; ulBestR = R; @@ -206,7 +205,6 @@ u32 ProgramClock(u32 refClock, but we shall keep this code in case new restrictions come into play --*/ if ((ulScore >= ulBestScore) && (OD > 0)) { - ulBestVCO = ulVCO; ulBestOD = OD; ulBestF = F; ulBestR = R; -- 2.25.4
[PATCH] video: fbdev: remove set but not used 'ulCoreClock'
This addresses the following gcc warning with "make W=1": drivers/video/fbdev/kyro/STG4000InitDevice.c: In function ‘SetCoreClockPLL’: drivers/video/fbdev/kyro/STG4000InitDevice.c:247:6: warning: variable ‘ulCoreClock’ set but not used [-Wunused-but-set-variable] // yanaijie fixed 247 | u32 ulCoreClock; | ^~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/video/fbdev/kyro/STG4000InitDevice.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/kyro/STG4000InitDevice.c b/drivers/video/fbdev/kyro/STG4000InitDevice.c index 1d3f2080aa6f..edaeec2d9590 100644 --- a/drivers/video/fbdev/kyro/STG4000InitDevice.c +++ b/drivers/video/fbdev/kyro/STG4000InitDevice.c @@ -244,7 +244,6 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev) { u32 F, R, P; u16 core_pll = 0, sub; - u32 ulCoreClock; u32 tmp; u32 ulChipSpeed; @@ -282,7 +281,7 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev) if (ulChipSpeed == 0) return -EINVAL; - ulCoreClock = ProgramClock(REF_FREQ, CORE_PLL_FREQ, , , ); + ProgramClock(REF_FREQ, CORE_PLL_FREQ, , , ); core_pll |= ((P) | ((F - 2) << 2) | ((R - 2) << 11)); -- 2.25.4
[PATCH] drm/nouveau/svm: remove set but not used 'ret'
This addresses the following gcc warning with "make W=1": drivers/gpu/drm/nouveau/nouveau_svm.c: In function ‘nouveau_pfns_map’: drivers/gpu/drm/nouveau/nouveau_svm.c:818:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 818 | int ret; | ^~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index 2df1c0460559..7c95ffcbd18f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -815,7 +815,6 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm, unsigned long addr, u64 *pfns, unsigned long npages) { struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); - int ret; args->p.addr = addr; args->p.size = npages << PAGE_SHIFT; @@ -823,8 +822,8 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm, mutex_lock(>mutex); svmm->vmm->vmm.object.client->super = true; - ret = nvif_object_ioctl(>vmm->vmm.object, args, sizeof(*args) + - npages * sizeof(args->p.phys[0]), NULL); + nvif_object_ioctl(>vmm->vmm.object, args, sizeof(*args) + + npages * sizeof(args->p.phys[0]), NULL); svmm->vmm->vmm.object.client->super = false; mutex_unlock(>mutex); -- 2.25.4
[PATCH] scsi: mptscsih: remove set but not used 'timeleft'
This addresses the following gcc warning with "make W=1": drivers/message/fusion/mptscsih.c: In function ‘mptscsih_IssueTaskMgmt’: drivers/message/fusion/mptscsih.c:1519:17: warning: variable ‘timeleft’ set but not used [-Wunused-but-set-variable] 1519 | unsigned long timeleft; | ^~~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/message/fusion/mptscsih.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 8543f0324d5a..a5ef9faf71c7 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1516,7 +1516,6 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun, int ii; int retval; MPT_ADAPTER *ioc = hd->ioc; - unsigned longtimeleft; u8 issue_hard_reset; u32 ioc_raw_state; unsigned longtime_count; @@ -1614,7 +1613,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun, } } - timeleft = wait_for_completion_timeout(>taskmgmt_cmds.done, + wait_for_completion_timeout(>taskmgmt_cmds.done, timeout*HZ); if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { retval = FAILED; -- 2.25.4
[PATCH] scsi: isci: remove set but not used 'index'
This addresses the following gcc warning with "make W=1": drivers/scsi/isci/host.c: In function ‘sci_controller_complete_io’: drivers/scsi/isci/host.c:2674:6: warning: variable ‘index’ set but not used [-Wunused-but-set-variable] 2674 | u16 index; | ^ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/scsi/isci/host.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 7b5deae68d33..7ebfa3c8cdc7 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c @@ -2671,7 +2671,6 @@ enum sci_status sci_controller_complete_io(struct isci_host *ihost, struct isci_request *ireq) { enum sci_status status; - u16 index; switch (ihost->sm.current_state_id) { case SCIC_STOPPING: @@ -2682,7 +2681,6 @@ enum sci_status sci_controller_complete_io(struct isci_host *ihost, if (status != SCI_SUCCESS) return status; - index = ISCI_TAG_TCI(ireq->io_tag); clear_bit(IREQ_ACTIVE, >flags); return SCI_SUCCESS; default: -- 2.25.4
[PATCH] scsi: dpt_i2o: remove set but not used 'pHba'
This addresses the following gcc warning with "make W=1": drivers/scsi/dpt_i2o.c: In function ‘adpt_slave_configure’: drivers/scsi/dpt_i2o.c:411:12: warning: variable ‘pHba’ set but not used [-Wunused-but-set-variable] 411 | adpt_hba* pHba; |^~~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/scsi/dpt_i2o.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index f654ad8a3d69..4251212acbbe 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -408,9 +408,6 @@ static void adpt_inquiry(adpt_hba* pHba) static int adpt_slave_configure(struct scsi_device * device) { struct Scsi_Host *host = device->host; - adpt_hba* pHba; - - pHba = (adpt_hba *) host->hostdata[0]; if (host->can_queue && device->tagged_supported) { scsi_change_queue_depth(device, -- 2.25.4
Re: [PATCH v1 2/2] {topost} scsi: libsas: check link status at ATA prereset() ops
在 2020/7/22 17:04, Luo Jiaxing 写道: We found out that libata will retry reset even if SATA disk is unpluged. We should report offline to libata to avoid meaningless reset on the disk. Libata provide an ops of prereset() for this purpose, it was called by ata_eh_reset() only and used to decide whether to skip reset base on the return value of it. We check status of phy and disk at prereset(). If disk is already offline or phy is disabled, we return -ENOENT to libata to skip disk reset. As prereset() should be best-effort, we should continue to try disk reset beyond the situation we mentioned before. Signed-off-by: Luo Jiaxing Reviewed-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) The same as the first one, after fix the subject: Reviewed-by: Jason Yan
Re: [PATCH v1 1/2] {topost} scsi: libsas: delete postreset at sas_sata_ops
在 2020/7/22 17:04, Luo Jiaxing 写道: We fill postreset with ata_std_postreset() at sas_sata_ops before, but we found out that ata_std_postreset() call sata_scr_read()/sata_scr_write() which need to access SCR register. Actually we don't own these kind of register, so sata_scr_read()/sata_scr_write always return -EOPNOTSUPP. We drop ata_std_postreset() at sas_sata_ops. Signed-off-by: Luo Jiaxing Reviewed-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 5d716d3..a7d16d2 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -510,7 +510,6 @@ void sas_ata_end_eh(struct ata_port *ap) static struct ata_port_operations sas_sata_ops = { .prereset = ata_std_prereset, .hardreset = sas_ata_hard_reset, - .postreset = ata_std_postreset, .error_handler = ata_std_error_handler, .post_internal_cmd = sas_ata_post_internal, .qc_defer = ata_std_qc_defer, Hi Luo, Please remove the "{topost}" in the subject, other than that: Reviewed-by: Jason Yan
[PATCH] f2fs: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." Fix it by remove this variable since it is not needed at all. [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Suggested-by: Chao Yu Signed-off-by: Jason Yan --- v2: Directly remove this variable. fs/f2fs/data.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 326c63879ddc..3753ba06531b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2856,7 +2856,6 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }; #endif int nr_pages; - pgoff_t uninitialized_var(writeback_index); pgoff_t index; pgoff_t end;/* Inclusive */ pgoff_t done_index; @@ -2875,8 +2874,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, clear_inode_flag(mapping->host, FI_HOT_DATA); if (wbc->range_cyclic) { - writeback_index = mapping->writeback_index; /* prev offset */ - index = writeback_index; + index = mapping->writeback_index; /* prev offset */ end = -1; } else { index = wbc->range_start >> PAGE_SHIFT; -- 2.25.4
Re: [f2fs-dev] [PATCH] f2fs: Eliminate usage of uninitialized_var() macro
在 2020/6/15 16:26, Chao Yu 写道: On 2020/6/15 12:02, Jason Yan wrote: This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Signed-off-by: Jason Yan --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 326c63879ddc..e6ec61274d76 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2856,7 +2856,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }; #endif int nr_pages; - pgoff_t uninitialized_var(writeback_index); + pgoff_t writeback_index; I suggest to delete this variable directly, as we did for mm in commit 28659cc8cc87 (mm/page-writeback.c: remove unused variable). Good suggestion, I will send v2. Thanks, Jason Thanks, pgoff_t index; pgoff_t end;/* Inclusive */ pgoff_t done_index; .
Re: [PATCH] erofs: Eliminate usage of uninitialized_var() macro
在 2020/6/15 15:25, Gao Xiang 写道: Hi Jason, On Mon, Jun 15, 2020 at 12:01:41PM +0800, Jason Yan wrote: This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Cc: Chao Yu Signed-off-by: Jason Yan --- I'm fine with the patch since "-Wmaybe-uninitialized" has been disabled and I've also asked Kees for it in private previously. I still remembered that Kees sent out a treewide patch. Sorry about that I don't catch up it... But what is wrong with the original patchset? Yes, Kees has remind me of that and I will let him handle it. So you can ignore this patch. Thanks, Jason Thanks, Gao Xiang .
[PATCH] ata: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Signed-off-by: Jason Yan --- drivers/ata/libata-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 435781a16875..fcb00f2825fe 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -93,7 +93,7 @@ static ssize_t ata_scsi_park_show(struct device *device, struct ata_link *link; struct ata_device *dev; unsigned long now; - unsigned int uninitialized_var(msecs); + unsigned int msecs; int rc = 0; ap = ata_shost_to_port(sdev->host); -- 2.25.4
[PATCH] f2fs: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Signed-off-by: Jason Yan --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 326c63879ddc..e6ec61274d76 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2856,7 +2856,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }; #endif int nr_pages; - pgoff_t uninitialized_var(writeback_index); + pgoff_t writeback_index; pgoff_t index; pgoff_t end;/* Inclusive */ pgoff_t done_index; -- 2.25.4
[PATCH] erofs: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Cc: Chao Yu Signed-off-by: Jason Yan --- fs/erofs/data.c | 4 ++-- fs/erofs/zdata.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 64b56c7df023..d0542151e8c4 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -265,7 +265,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, */ static int erofs_raw_access_readpage(struct file *file, struct page *page) { - erofs_off_t uninitialized_var(last_block); + erofs_off_t last_block; struct bio *bio; trace_erofs_readpage(page, true); @@ -282,7 +282,7 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page) static void erofs_raw_access_readahead(struct readahead_control *rac) { - erofs_off_t uninitialized_var(last_block); + erofs_off_t last_block; struct bio *bio = NULL; struct page *page; diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index be50a4d9d273..24a26aaf847f 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1161,7 +1161,7 @@ static void z_erofs_submit_queue(struct super_block *sb, struct z_erofs_decompressqueue *q[NR_JOBQUEUES]; void *bi_private; /* since bio will be NULL, no need to initialize last_index */ - pgoff_t uninitialized_var(last_index); + pgoff_t last_index; unsigned int nr_bios = 0; struct bio *bio = NULL; -- 2.25.4
[PATCH] ACPI: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Signed-off-by: Jason Yan --- drivers/acpi/acpi_pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index e7dc0133f817..6cc4c92d9ff9 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -88,7 +88,7 @@ static void round_robin_cpu(unsigned int tsk_index) cpumask_var_t tmp; int cpu; unsigned long min_weight = -1; - unsigned long uninitialized_var(preferred_cpu); + unsigned long preferred_cpu; if (!alloc_cpumask_var(, GFP_KERNEL)) return; -- 2.25.4
[PATCH] block: Eliminate usage of uninitialized_var() macro
This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." The gcc option "-Wmaybe-uninitialized" has been disabled and this change will not produce any warnnings even with "make W=1". [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Cc: Kees Cook Cc: Ming Lei Signed-off-by: Jason Yan --- block/blk-merge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index f0b0bae075a0..006402edef6b 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -473,7 +473,7 @@ static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, struct scatterlist *sglist, struct scatterlist **sg) { - struct bio_vec uninitialized_var(bvec), bvprv = { NULL }; + struct bio_vec bvec, bvprv = { NULL }; struct bvec_iter iter; int nsegs = 0; bool new_bio = false; -- 2.25.4
Re: [PATCH] powerpc/fsl_booke/32: fix build with CONFIG_RANDOMIZE_BASE
在 2020/6/14 0:28, Arseny Solokha 写道: Building the current 5.8 kernel for a e500 machine with CONFIG_RANDOMIZE_BASE set yields the following failure: arch/powerpc/mm/nohash/kaslr_booke.c: In function 'kaslr_early_init': arch/powerpc/mm/nohash/kaslr_booke.c:387:2: error: implicit declaration of function 'flush_icache_range'; did you mean 'flush_tlb_range'? [-Werror=implicit-function-declaration] Indeed, including asm/cacheflush.h into kaslr_booke.c fixes the build. The issue dates back to the introduction of that file and probably went unnoticed because there's no in-tree defconfig with CONFIG_RANDOMIZE_BASE set. Fixes: 2b0e86cc5de6 ("powerpc/fsl_booke/32: implement KASLR infrastructure") Cc: sta...@vger.kernel.org Signed-off-by: Arseny Solokha --- arch/powerpc/mm/nohash/kaslr_booke.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Jason Yan
[PATCH v5] block: Fix use-after-free in blkdev_get()
x94/0x4e0 [ 459.404607] bd_acquire+0xfa/0x2c0 [ 459.405113] blkdev_open+0x110/0x290 [ 459.405702] do_dentry_open+0x49e/0x1050 [ 459.406340] path_openat+0x148c/0x3f50 [ 459.406926] do_filp_open+0x1a1/0x280 [ 459.407471] do_sys_open+0x3c3/0x500 [ 459.408010] do_syscall_64+0xc3/0x520 [ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.409415] [ 459.409679] Freed by task 1262: [ 459.410212] __kasan_slab_free+0x129/0x170 [ 459.410919] kmem_cache_free+0xb2/0x2a0 [ 459.411564] rcu_process_callbacks+0xbb2/0x2320 [ 459.412318] __do_softirq+0x225/0x8ac Fix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev. Fixes: e525fd89d380 ("block: make blkdev_get/put() handle exclusive access") Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Jan Kara Reported-by: Hulk Robot Signed-off-by: Jason Yan Reviewed-by: Jan Kara Reviewed-by: Christoph Hellwig --- v5: Add fixes tag and Reviewed-by tag from Christoph. v4: Remove uneeded braces and add Reviewed-by tag from Jan Kara. v3: Add bdput() when __blkdev_get() calling itself failed. v2: Add Reported-by tag and cc linux-block mailing list fs/block_dev.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..08c87db3a92b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1565,10 +1565,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) */ if (!for_part) { ret = devcgroup_inode_permission(bdev->bd_inode, perm); - if (ret != 0) { - bdput(bdev); + if (ret != 0) return ret; - } } restart: @@ -1637,8 +1635,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear; BUG_ON(for_part); ret = __blkdev_get(whole, mode, 1); - if (ret) + if (ret) { + bdput(whole); goto out_clear; + } bdev->bd_contains = whole; bdev->bd_part = disk_get_part(disk, partno); if (!(disk->flags & GENHD_FL_UP) || @@ -1688,7 +1688,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) disk_unblock_events(disk); put_disk_and_module(disk); out: - bdput(bdev); return ret; } @@ -1755,6 +1754,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) bdput(whole); } + if (res) + bdput(bdev); + return res; } EXPORT_SYMBOL(blkdev_get); -- 2.21.3
Re: [PATCH v4] block: Fix use-after-free in blkdev_get()
Hi Christoph, 在 2020/6/8 14:15, Christoph Hellwig 写道: Looks good, Reviewed-by: Christoph Hellwig Can you dig into the history for a proper fixes tag? This one started to accessing bdev after __blkdev_get(). So I think it may be a proper fixes tag: Fixes: e525fd89d380 ("block: make blkdev_get/put() handle exclusive access") Thanks, Jason .
[PATCH v4] block: Fix use-after-free in blkdev_get()
x94/0x4e0 [ 459.404607] bd_acquire+0xfa/0x2c0 [ 459.405113] blkdev_open+0x110/0x290 [ 459.405702] do_dentry_open+0x49e/0x1050 [ 459.406340] path_openat+0x148c/0x3f50 [ 459.406926] do_filp_open+0x1a1/0x280 [ 459.407471] do_sys_open+0x3c3/0x500 [ 459.408010] do_syscall_64+0xc3/0x520 [ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.409415] [ 459.409679] Freed by task 1262: [ 459.410212] __kasan_slab_free+0x129/0x170 [ 459.410919] kmem_cache_free+0xb2/0x2a0 [ 459.411564] rcu_process_callbacks+0xbb2/0x2320 [ 459.412318] __do_softirq+0x225/0x8ac Fix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev. Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Jan Kara Reported-by: Hulk Robot Signed-off-by: Jason Yan Reviewed-by: Jan Kara --- v4: Remove uneeded braces and add Reviewed-by tag from Jan Kara. v3: Add bdput() when __blkdev_get() calling itself failed. v2: Add Reported-by tag and cc linux-block mailing list fs/block_dev.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..08c87db3a92b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1565,10 +1565,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) */ if (!for_part) { ret = devcgroup_inode_permission(bdev->bd_inode, perm); - if (ret != 0) { - bdput(bdev); + if (ret != 0) return ret; - } } restart: @@ -1637,8 +1635,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear; BUG_ON(for_part); ret = __blkdev_get(whole, mode, 1); - if (ret) + if (ret) { + bdput(whole); goto out_clear; + } bdev->bd_contains = whole; bdev->bd_part = disk_get_part(disk, partno); if (!(disk->flags & GENHD_FL_UP) || @@ -1688,7 +1688,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) disk_unblock_events(disk); put_disk_and_module(disk); out: - bdput(bdev); return ret; } @@ -1755,6 +1754,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) bdput(whole); } + if (res) + bdput(bdev); + return res; } EXPORT_SYMBOL(blkdev_get); -- 2.21.3
Re: [PATCH v3] block: Fix use-after-free in blkdev_get()
在 2020/6/5 22:37, Jan Kara 写道: No need for braces here after you remove bdput(). With this fixed, feel free to add: Reviewed-by: Jan Kara Thanks, I will fix it in v4. Jason
Re: [PATCH v3] block: Fix use-after-free in blkdev_get()
在 2020/6/5 19:05, Sedat Dilek 写道: On Fri, Jun 5, 2020 at 12:23 PM Jason Yan wrote: In blkdev_get() we call __blkdev_get() to do some internal jobs and if there is some errors in __blkdev_get(), the bdput() is called which means we have released the refcount of the bdev (actually the refcount of the bdev inode). This means we cannot access bdev after that point. But accually bdev is still accessed in blkdev_get() after calling __blkdev_get(). This may leads to use-after-free if the refcount is the last one we released in __blkdev_get(). Let's take a look at the following scenerio: CPU0CPU1CPU2 blkdev_open blkdev_open Remove disk bd_acquire blkdev_get __blkdev_get del_gendisk bdev_unhash_inode bd_acquire bdev_get_gendisk bd_forget failed because of unhashed bdput bdput (the last one) bdev_evict_inode access bdev => use after free [ 459.350216] BUG: KASAN: use-after-free in __lock_acquire+0x24c1/0x31b0 [ 459.351190] Read of size 8 at addr 88806c815a80 by task syz-executor.0/20132 [ 459.352347] [ 459.352594] CPU: 0 PID: 20132 Comm: syz-executor.0 Not tainted 4.19.90 #2 [ 459.353628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 459.354947] Call Trace: [ 459.355337] dump_stack+0x111/0x19e [ 459.355879] ? __lock_acquire+0x24c1/0x31b0 [ 459.356523] print_address_description+0x60/0x223 [ 459.357248] ? __lock_acquire+0x24c1/0x31b0 [ 459.357887] kasan_report.cold+0xae/0x2d8 [ 459.358503] __lock_acquire+0x24c1/0x31b0 [ 459.359120] ? _raw_spin_unlock_irq+0x24/0x40 [ 459.359784] ? lockdep_hardirqs_on+0x37b/0x580 [ 459.360465] ? _raw_spin_unlock_irq+0x24/0x40 [ 459.361123] ? finish_task_switch+0x125/0x600 [ 459.361812] ? finish_task_switch+0xee/0x600 [ 459.362471] ? mark_held_locks+0xf0/0xf0 [ 459.363108] ? __schedule+0x96f/0x21d0 [ 459.363716] lock_acquire+0x111/0x320 [ 459.364285] ? blkdev_get+0xce/0xbe0 [ 459.364846] ? blkdev_get+0xce/0xbe0 [ 459.365390] __mutex_lock+0xf9/0x12a0 [ 459.365948] ? blkdev_get+0xce/0xbe0 [ 459.366493] ? bdev_evict_inode+0x1f0/0x1f0 [ 459.367130] ? blkdev_get+0xce/0xbe0 [ 459.367678] ? destroy_inode+0xbc/0x110 [ 459.368261] ? mutex_trylock+0x1a0/0x1a0 [ 459.368867] ? __blkdev_get+0x3e6/0x1280 [ 459.369463] ? bdev_disk_changed+0x1d0/0x1d0 [ 459.370114] ? blkdev_get+0xce/0xbe0 [ 459.370656] blkdev_get+0xce/0xbe0 [ 459.371178] ? find_held_lock+0x2c/0x110 [ 459.371774] ? __blkdev_get+0x1280/0x1280 [ 459.372383] ? lock_downgrade+0x680/0x680 [ 459.373002] ? lock_acquire+0x111/0x320 [ 459.373587] ? bd_acquire+0x21/0x2c0 [ 459.374134] ? do_raw_spin_unlock+0x4f/0x250 [ 459.374780] blkdev_open+0x202/0x290 [ 459.375325] do_dentry_open+0x49e/0x1050 [ 459.375924] ? blkdev_get_by_dev+0x70/0x70 [ 459.376543] ? __x64_sys_fchdir+0x1f0/0x1f0 [ 459.377192] ? inode_permission+0xbe/0x3a0 [ 459.377818] path_openat+0x148c/0x3f50 [ 459.378392] ? kmem_cache_alloc+0xd5/0x280 [ 459.379016] ? entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.379802] ? path_lookupat.isra.0+0x900/0x900 [ 459.380489] ? __lock_is_held+0xad/0x140 [ 459.381093] do_filp_open+0x1a1/0x280 [ 459.381654] ? may_open_dev+0xf0/0xf0 [ 459.382214] ? find_held_lock+0x2c/0x110 [ 459.382816] ? lock_downgrade+0x680/0x680 [ 459.383425] ? __lock_is_held+0xad/0x140 [ 459.384024] ? do_raw_spin_unlock+0x4f/0x250 [ 459.384668] ? _raw_spin_unlock+0x1f/0x30 [ 459.385280] ? __alloc_fd+0x448/0x560 [ 459.385841] do_sys_open+0x3c3/0x500 [ 459.386386] ? filp_open+0x70/0x70 [ 459.386911] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 459.387610] ? trace_hardirqs_off_caller+0x55/0x1c0 [ 459.388342] ? do_syscall_64+0x1a/0x520 [ 459.388930] do_syscall_64+0xc3/0x520 [ 459.389490] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.390248] RIP: 0033:0x416211 [ 459.390720] Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 19 00 00 c3 48 83 ec 08 e8 0a fa ff ff 48 89 04 24 b8 02 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fa ff ff 48 89 d0 48 83 c4 08 48 3d 01 [ 459.393483] RSP: 002b:7fe45dfe9a60 EFLAGS: 0293 ORIG_RAX: 0002 [ 459.394610] RAX: ffda RBX: 7fe45dfea6d4 RCX: 00416211 [ 459.395678] RDX: 7fe45dfe9b0a RSI: 0002 RDI: 7fe45dfe9b00 [ 459.396758] RBP: 0076bf20 R08: R09: 000a [ 459.397930] R10: 0075 R11: 0293 R12: [ 459.399022] R13: 0bd9 R14: 004cdb80 R15: 0076bf2c [ 459.400168] [ 459.400430] Allocated by task 20132: [ 459.401038] kasan_kmalloc+0xbf/0xe0 [ 459.401652] kmem_cache_alloc+0xd5/0x280 [ 459.402330] bdev_alloc_inode+0x18/0x40 [ 4
[PATCH v3] block: Fix use-after-free in blkdev_get()
x94/0x4e0 [ 459.404607] bd_acquire+0xfa/0x2c0 [ 459.405113] blkdev_open+0x110/0x290 [ 459.405702] do_dentry_open+0x49e/0x1050 [ 459.406340] path_openat+0x148c/0x3f50 [ 459.406926] do_filp_open+0x1a1/0x280 [ 459.407471] do_sys_open+0x3c3/0x500 [ 459.408010] do_syscall_64+0xc3/0x520 [ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.409415] [ 459.409679] Freed by task 1262: [ 459.410212] __kasan_slab_free+0x129/0x170 [ 459.410919] kmem_cache_free+0xb2/0x2a0 [ 459.411564] rcu_process_callbacks+0xbb2/0x2320 [ 459.412318] __do_softirq+0x225/0x8ac Fix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev. Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Jan Kara Reported-by: Hulk Robot Signed-off-by: Jason Yan --- v3: Add bdput() when __blkdev_get() calling itself failed. v2: Add Reported-by tag and cc linux-block mailing list fs/block_dev.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..d7b74e44ad5a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1566,7 +1566,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) if (!for_part) { ret = devcgroup_inode_permission(bdev->bd_inode, perm); if (ret != 0) { - bdput(bdev); return ret; } } @@ -1637,8 +1636,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear; BUG_ON(for_part); ret = __blkdev_get(whole, mode, 1); - if (ret) + if (ret) { + bdput(whole); goto out_clear; + } bdev->bd_contains = whole; bdev->bd_part = disk_get_part(disk, partno); if (!(disk->flags & GENHD_FL_UP) || @@ -1688,7 +1689,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) disk_unblock_events(disk); put_disk_and_module(disk); out: - bdput(bdev); return ret; } @@ -1755,6 +1755,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) bdput(whole); } + if (res) + bdput(bdev); + return res; } EXPORT_SYMBOL(blkdev_get); -- 2.21.3
Re: [PATCH v2] block: Fix use-after-free in blkdev_get()
Hi, Markus Thanks for the review. Sorry for the wording because I'm not an English native speaker. 在 2020/6/5 16:30, Markus Elfring 写道: Would you like to add the tag “Fixes” to the commit message? I tried to find the commit in the git history which introduced this issue, but I am not sure which one is it. It seems existed there for a long time. Thanks, Jason Regards, Markus
[PATCH v2] block: Fix use-after-free in blkdev_get()
x94/0x4e0 [ 459.404607] bd_acquire+0xfa/0x2c0 [ 459.405113] blkdev_open+0x110/0x290 [ 459.405702] do_dentry_open+0x49e/0x1050 [ 459.406340] path_openat+0x148c/0x3f50 [ 459.406926] do_filp_open+0x1a1/0x280 [ 459.407471] do_sys_open+0x3c3/0x500 [ 459.408010] do_syscall_64+0xc3/0x520 [ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.409415] [ 459.409679] Freed by task 1262: [ 459.410212] __kasan_slab_free+0x129/0x170 [ 459.410919] kmem_cache_free+0xb2/0x2a0 [ 459.411564] rcu_process_callbacks+0xbb2/0x2320 [ 459.412318] __do_softirq+0x225/0x8ac Fix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev. Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Jan Kara Reported-by: Hulk Robot Signed-off-by: Jason Yan --- v2: Add Reported-by tag and cc linux-block mailing list fs/block_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..8faec9fb47b6 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1566,7 +1566,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) if (!for_part) { ret = devcgroup_inode_permission(bdev->bd_inode, perm); if (ret != 0) { - bdput(bdev); return ret; } } @@ -1688,7 +1687,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) disk_unblock_events(disk); put_disk_and_module(disk); out: - bdput(bdev); return ret; } @@ -1755,6 +1753,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) bdput(whole); } + if (res) + bdput(bdev); + return res; } EXPORT_SYMBOL(blkdev_get); -- 2.21.3
[PATCH] block: Fix use-after-free in blkdev_get()
x94/0x4e0 [ 459.404607] bd_acquire+0xfa/0x2c0 [ 459.405113] blkdev_open+0x110/0x290 [ 459.405702] do_dentry_open+0x49e/0x1050 [ 459.406340] path_openat+0x148c/0x3f50 [ 459.406926] do_filp_open+0x1a1/0x280 [ 459.407471] do_sys_open+0x3c3/0x500 [ 459.408010] do_syscall_64+0xc3/0x520 [ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 459.409415] [ 459.409679] Freed by task 1262: [ 459.410212] __kasan_slab_free+0x129/0x170 [ 459.410919] kmem_cache_free+0xb2/0x2a0 [ 459.411564] rcu_process_callbacks+0xbb2/0x2320 [ 459.412318] __do_softirq+0x225/0x8ac Fix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev. Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Jan Kara Signed-off-by: Jason Yan --- fs/block_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..8faec9fb47b6 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1566,7 +1566,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) if (!for_part) { ret = devcgroup_inode_permission(bdev->bd_inode, perm); if (ret != 0) { - bdput(bdev); return ret; } } @@ -1688,7 +1687,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) disk_unblock_events(disk); put_disk_and_module(disk); out: - bdput(bdev); return ret; } @@ -1755,6 +1753,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) bdput(whole); } + if (res) + bdput(bdev); + return res; } EXPORT_SYMBOL(blkdev_get); -- 2.21.3
[tip: timers/core] clocksource/drivers/atmel-st: Remove useless 'status'
The following commit has been merged into the timers/core branch of tip: Commit-ID: 8c42c0f72d7c4f295646d3eba73f62e5579b1732 Gitweb: https://git.kernel.org/tip/8c42c0f72d7c4f295646d3eba73f62e5579b1732 Author:Jason Yan AuthorDate:Tue, 14 Apr 2020 20:02:38 +08:00 Committer: Daniel Lezcano CommitterDate: Wed, 15 Apr 2020 10:57:15 +02:00 clocksource/drivers/atmel-st: Remove useless 'status' Fix the following coccicheck warning: drivers/clocksource/timer-atmel-st.c:142:6-12: Unneeded variable: "status". Return "0" on line 166 Signed-off-by: Jason Yan Acked-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200414120238.35704-1-yanai...@huawei.com --- drivers/clocksource/timer-atmel-st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c index ab0aabf..73e8aee 100644 --- a/drivers/clocksource/timer-atmel-st.c +++ b/drivers/clocksource/timer-atmel-st.c @@ -139,7 +139,6 @@ static int clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) { u32 alm; - int status = 0; unsigned intval; BUG_ON(delta < 2); @@ -163,7 +162,7 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) alm += delta; regmap_write(regmap_st, AT91_ST_RTAR, alm); - return status; + return 0; } static struct clock_event_device clkevt = {
[PATCH v2] scsi: hisi_sas: display proc_name in sysfs
The 'proc_name' entry in sysfs for hisi_sas is 'null' now becuase it is not initialized in scsi_host_template. It looks like: [root@localhost ~]# cat /sys/class/scsi_host/host2/proc_name (null) While the other driver's entry looks like: linux-vnMQMU:~ # cat /sys/class/scsi_host/host0/proc_name megaraid_sas Cc: John Garry Cc: Xiang Chen Signed-off-by: Jason Yan Acked-by: John Garry --- v2: change subject to "display proc_name in sysfs" and add "Acked-by" tag. drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index fa25766502a2..c205bff20943 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1757,6 +1757,7 @@ static struct device_attribute *host_attrs_v1_hw[] = { static struct scsi_host_template sht_v1_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index e05faf315dcd..c725cffe141e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3533,6 +3533,7 @@ static struct device_attribute *host_attrs_v2_hw[] = { static struct scsi_host_template sht_v2_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 374885aa8d77..59b1421607dd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3071,6 +3071,7 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) static struct scsi_host_template sht_v3_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, -- 2.21.3
Re: [PATCH] scsi: hisi_sas: display correct proc_name in sysfs
在 2020/5/12 19:07, John Garry 写道: On 12/05/2020 11:30, Jason Yan wrote: 在 2020/5/12 18:00, John Garry 写道: On 12/05/2020 10:35, Jason Yan wrote: 在 2020/5/12 16:23, John Garry 写道: On 12/05/2020 07:33, Jason Yan wrote: The 'proc_name' entry in sysfs for hisi_sas is 'null' now becuase it is not initialized in scsi_host_template. It looks like: [root@localhost ~]# cat /sys/class/scsi_host/host2/proc_name (null) hmmm.. it would be good to tell us what this buys us, apart from the proc_name file. When there is more than one storage cards(or controllers) in the system, I'm tring to find out which host is belong to which card. And then I found this in scsi_host in sysfs but the output is '(null)' which is odd. "dmesg | grep host" would give this info, like: root@(none)$ dmesg | grep host0 [ 8.877245] scsi host0: hisi_sas_v2_hw NO, if long time after the system boot, dmesg cannot get this infomation. It is flushed by other logs. ok, so I don't see any other way to currently do this, even though using proc_name is a bit suspect, so: Acked-by: John Garry And the $subject is not right. It should be simply "display proc_name in sysfs". Thanks, will send v2 with right $subject. Jason Thanks, John .
Re: [PATCH] scsi: hisi_sas: display correct proc_name in sysfs
在 2020/5/12 18:00, John Garry 写道: On 12/05/2020 10:35, Jason Yan wrote: 在 2020/5/12 16:23, John Garry 写道: On 12/05/2020 07:33, Jason Yan wrote: The 'proc_name' entry in sysfs for hisi_sas is 'null' now becuase it is not initialized in scsi_host_template. It looks like: [root@localhost ~]# cat /sys/class/scsi_host/host2/proc_name (null) hmmm.. it would be good to tell us what this buys us, apart from the proc_name file. When there is more than one storage cards(or controllers) in the system, I'm tring to find out which host is belong to which card. And then I found this in scsi_host in sysfs but the output is '(null)' which is odd. "dmesg | grep host" would give this info, like: root@(none)$ dmesg | grep host0 [ 8.877245] scsi host0: hisi_sas_v2_hw NO, if long time after the system boot, dmesg cannot get this infomation. It is flushed by other logs. I mean, if we had the sht show_info method implemented, then it could be useful (which is even marked as obsolete now). I found this is interesting while in the sysfs filesystem we have a procfs stuff in it. It's only the name of the procfs entry, if it exists. And, since .show_info is obsolete, I don't see why .proc_name is not also obsolete. I was planned to rename this entry to 'name' and use the struct member 'name' directly in struct scsi_host_template. But this may break userspace applications. Thanks, John .
Re: [PATCH] scsi: hisi_sas: display correct proc_name in sysfs
在 2020/5/12 16:23, John Garry 写道: On 12/05/2020 07:33, Jason Yan wrote: The 'proc_name' entry in sysfs for hisi_sas is 'null' now becuase it is not initialized in scsi_host_template. It looks like: [root@localhost ~]# cat /sys/class/scsi_host/host2/proc_name (null) hmmm.. it would be good to tell us what this buys us, apart from the proc_name file. When there is more than one storage cards(or controllers) in the system, I'm tring to find out which host is belong to which card. And then I found this in scsi_host in sysfs but the output is '(null)' which is odd. I mean, if we had the sht show_info method implemented, then it could be useful (which is even marked as obsolete now). I found this is interesting while in the sysfs filesystem we have a procfs stuff in it. I was planned to rename this entry to 'name' and use the struct member 'name' directly in struct scsi_host_template. But this may break userspace applications. Thanks, John While the other driver's entry looks like: linux-vnMQMU:~ # cat /sys/class/scsi_host/host0/proc_name megaraid_sas Cc: John Garry Cc: Xiang Chen Signed-off-by: Jason Yan --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index fa25766502a2..c205bff20943 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1757,6 +1757,7 @@ static struct device_attribute *host_attrs_v1_hw[] = { static struct scsi_host_template sht_v1_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index e05faf315dcd..c725cffe141e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3533,6 +3533,7 @@ static struct device_attribute *host_attrs_v2_hw[] = { static struct scsi_host_template sht_v2_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 374885aa8d77..59b1421607dd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3071,6 +3071,7 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) static struct scsi_host_template sht_v3_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, .
[PATCH] scsi: hisi_sas: display correct proc_name in sysfs
The 'proc_name' entry in sysfs for hisi_sas is 'null' now becuase it is not initialized in scsi_host_template. It looks like: [root@localhost ~]# cat /sys/class/scsi_host/host2/proc_name (null) While the other driver's entry looks like: linux-vnMQMU:~ # cat /sys/class/scsi_host/host0/proc_name megaraid_sas Cc: John Garry Cc: Xiang Chen Signed-off-by: Jason Yan --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index fa25766502a2..c205bff20943 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1757,6 +1757,7 @@ static struct device_attribute *host_attrs_v1_hw[] = { static struct scsi_host_template sht_v1_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index e05faf315dcd..c725cffe141e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3533,6 +3533,7 @@ static struct device_attribute *host_attrs_v2_hw[] = { static struct scsi_host_template sht_v2_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 374885aa8d77..59b1421607dd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3071,6 +3071,7 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) static struct scsi_host_template sht_v3_hw = { .name = DRV_NAME, + .proc_name = DRV_NAME, .module = THIS_MODULE, .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, -- 2.21.3
[tip: core/rcu] rcutorture: Make rcu_fwds and rcu_fwd_emergency_stop static
The following commit has been merged into the core/rcu branch of tip: Commit-ID: afbc1574f1da13d2fd2b30a96090b37c5933f957 Gitweb: https://git.kernel.org/tip/afbc1574f1da13d2fd2b30a96090b37c5933f957 Author:Jason Yan AuthorDate:Thu, 09 Apr 2020 19:42:38 +08:00 Committer: Paul E. McKenney CommitterDate: Thu, 07 May 2020 10:15:29 -07:00 rcutorture: Make rcu_fwds and rcu_fwd_emergency_stop static This commit fixes the following sparse warning: kernel/rcu/rcutorture.c:1695:16: warning: symbol 'rcu_fwds' was not declared. Should it be static? kernel/rcu/rcutorture.c:1696:6: warning: symbol 'rcu_fwd_emergency_stop' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 3d47dca..c7b7594 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1721,8 +1721,8 @@ struct rcu_fwd { unsigned long rcu_launder_gp_seq_start; }; -struct rcu_fwd *rcu_fwds; -bool rcu_fwd_emergency_stop; +static struct rcu_fwd *rcu_fwds; +static bool rcu_fwd_emergency_stop; static void rcu_torture_fwd_cb_hist(struct rcu_fwd *rfp) {
Re: [PATCH] scsi: libsas: Replace zero-length array with flexible-array
在 2020/5/8 3:21, Gustavo A. R. Silva 写道: The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] sizeof(flexible-array-member) triggers a warning because flexible array members have incomplete type[1]. There are some instances of code in which the sizeof operator is being incorrectly/erroneously applied to zero-length arrays and the result is zero. Such instances may be hiding some bugs. So, this work (flexible-array member conversions) will also help to get completely rid of those sorts of issues. This issue was found with the help of Coccinelle. [1]https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2]https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva Reviewed-by: Jason Yan
Re: [PATCH] drm/panel: visionox-rm69299: Add module license
在 2020/5/9 14:36, Randy Dunlap 写道: On 5/8/20 11:30 PM, Jason Yan wrote: Fix the following build warning: WARNING: modpost: missing MODULE_LICENSE() in drivers/gpu/drm/panel/panel-visionox-rm69299.o see include/linux/module.h for more information Signed-off-by: Jason Yan --- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c index 25fe8b0bb040..ec279ffdbd94 100644 --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c @@ -300,3 +300,4 @@ static struct mipi_dsi_driver visionox_rm69299_driver = { module_mipi_dsi_driver(visionox_rm69299_driver); MODULE_DESCRIPTION("Visionox RM69299 DSI Panel Driver"); +MODULE_LICENSE("GPL"); I sent a patch for this yesterday. I'm sorry. Please ignore this one. Thanks,
[PATCH] drm/panel: visionox-rm69299: Add module license
Fix the following build warning: WARNING: modpost: missing MODULE_LICENSE() in drivers/gpu/drm/panel/panel-visionox-rm69299.o see include/linux/module.h for more information Signed-off-by: Jason Yan --- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c index 25fe8b0bb040..ec279ffdbd94 100644 --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c @@ -300,3 +300,4 @@ static struct mipi_dsi_driver visionox_rm69299_driver = { module_mipi_dsi_driver(visionox_rm69299_driver); MODULE_DESCRIPTION("Visionox RM69299 DSI Panel Driver"); +MODULE_LICENSE("GPL"); -- 2.21.1
[PATCH] drm/amd/amdgpu: remove defined but not used 'crtc_offsets'
Fix the following gcc warning: drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:65:18: warning: ‘crtc_offsets’ defined but not used [-Wunused-const-variable=] static const u32 crtc_offsets[6] = ^~~~ Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index c1a530dbe162..a75e472b4a81 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c @@ -61,17 +61,6 @@ MODULE_FIRMWARE("amdgpu/si58_mc.bin"); #define MC_SEQ_MISC0__MT__HBM0x6000 #define MC_SEQ_MISC0__MT__DDR3 0xB000 - -static const u32 crtc_offsets[6] = -{ - SI_CRTC0_REGISTER_OFFSET, - SI_CRTC1_REGISTER_OFFSET, - SI_CRTC2_REGISTER_OFFSET, - SI_CRTC3_REGISTER_OFFSET, - SI_CRTC4_REGISTER_OFFSET, - SI_CRTC5_REGISTER_OFFSET -}; - static void gmc_v6_0_mc_stop(struct amdgpu_device *adev) { u32 blackout; -- 2.21.1
[PATCH net-next] igb: make igb_set_fc_watermarks() return void
This function always return 0 now, we can make it return void to simplify the code. This fixes the following coccicheck warning: drivers/net/ethernet/intel/igb/e1000_mac.c:728:5-12: Unneeded variable: "ret_val". Return "0" on line 751 Signed-off-by: Jason Yan --- drivers/net/ethernet/intel/igb/e1000_mac.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c index 79ee0a747260..3254737c07a3 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.c +++ b/drivers/net/ethernet/intel/igb/e1000_mac.c @@ -12,7 +12,7 @@ #include "igb.h" static s32 igb_set_default_fc(struct e1000_hw *hw); -static s32 igb_set_fc_watermarks(struct e1000_hw *hw); +static void igb_set_fc_watermarks(struct e1000_hw *hw); /** * igb_get_bus_info_pcie - Get PCIe bus information @@ -687,7 +687,7 @@ s32 igb_setup_link(struct e1000_hw *hw) wr32(E1000_FCTTV, hw->fc.pause_time); - ret_val = igb_set_fc_watermarks(hw); + igb_set_fc_watermarks(hw); out: @@ -723,9 +723,8 @@ void igb_config_collision_dist(struct e1000_hw *hw) * flow control XON frame transmission is enabled, then set XON frame * tansmission as well. **/ -static s32 igb_set_fc_watermarks(struct e1000_hw *hw) +static void igb_set_fc_watermarks(struct e1000_hw *hw) { - s32 ret_val = 0; u32 fcrtl = 0, fcrth = 0; /* Set the flow control receive threshold registers. Normally, @@ -747,8 +746,6 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw) } wr32(E1000_FCRTL, fcrtl); wr32(E1000_FCRTH, fcrth); - - return ret_val; } /** -- 2.21.1
[PATCH net-next] net: encx24j600: make encx24j600_hw_init() return void
This function always return 0 now, we can make it return void to simplify the code. This fixes the following coccicheck warning: drivers/net/ethernet/microchip/encx24j600.c:609:5-8: Unneeded variable: "ret". Return "0" on line 653 Signed-off-by: Jason Yan --- drivers/net/ethernet/microchip/encx24j600.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c index 39925e4bf2ec..fccc4805247f 100644 --- a/drivers/net/ethernet/microchip/encx24j600.c +++ b/drivers/net/ethernet/microchip/encx24j600.c @@ -604,9 +604,8 @@ static void encx24j600_set_rxfilter_mode(struct encx24j600_priv *priv) } } -static int encx24j600_hw_init(struct encx24j600_priv *priv) +static void encx24j600_hw_init(struct encx24j600_priv *priv) { - int ret = 0; u16 macon2; priv->hw_enabled = false; @@ -649,8 +648,6 @@ static int encx24j600_hw_init(struct encx24j600_priv *priv) if (netif_msg_hw(priv)) encx24j600_dump_config(priv, "Hw is initialized"); - - return ret; } static void encx24j600_hw_enable(struct encx24j600_priv *priv) @@ -1042,12 +1039,7 @@ static int encx24j600_spi_probe(struct spi_device *spi) } /* Initialize the device HW to the consistent state */ - if (encx24j600_hw_init(priv)) { - netif_err(priv, probe, ndev, - DRV_NAME ": HW initialization error\n"); - ret = -EIO; - goto out_free; - } + encx24j600_hw_init(priv); kthread_init_worker(>kworker); kthread_init_work(>tx_work, encx24j600_tx_proc); -- 2.21.1
[PATCH net-next] net: tulip: de4x5: make PCI_signature() return void
This function always return 0 now, we can make it return void to simplify the code. This fixes the following coccicheck warning: drivers/net/ethernet/dec/tulip/de4x5.c:3908:11-17: Unneeded variable: "status". Return "0" on line 3912 Signed-off-by: Jason Yan --- drivers/net/ethernet/dec/tulip/de4x5.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index f16853c3c851..0ccd9994ad45 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c @@ -951,7 +951,7 @@ static voidreset_init_sia(struct net_device *dev, s32 sicr, s32 strr, s32 si static int test_ans(struct net_device *dev, s32 irqs, s32 irq_mask, s32 msec); static int test_tp(struct net_device *dev, s32 msec); static int EISA_signature(char *name, struct device *device); -static int PCI_signature(char *name, struct de4x5_private *lp); +static voidPCI_signature(char *name, struct de4x5_private *lp); static voidDevicePresent(struct net_device *dev, u_long iobase); static voidenet_addr_rst(u_long aprom_addr); static int de4x5_bad_srom(struct de4x5_private *lp); @@ -3902,14 +3902,14 @@ EISA_signature(char *name, struct device *device) /* ** Look for a particular board name in the PCI configuration space */ -static int +static void PCI_signature(char *name, struct de4x5_private *lp) { -int i, status = 0, siglen = ARRAY_SIZE(de4x5_signatures); +int i, siglen = ARRAY_SIZE(de4x5_signatures); if (lp->chipset == DC21040) { strcpy(name, "DE434/5"); - return status; + return; } else { /* Search for a DEC name in the SROM */ int tmp = *((char *)>srom + 19) * 3; strncpy(name, (char *)>srom + 26 + tmp, 8); @@ -3935,8 +3935,6 @@ PCI_signature(char *name, struct de4x5_private *lp) } else if ((lp->chipset & ~0x00ff) == DC2114x) { lp->useSROM = true; } - -return status; } /* -- 2.21.1
[PATCH net-next] net: atheros: remove dead code in atl1c_resume()
This code has been marked dead for nearly 10 years. Remove it. Signed-off-by: Jason Yan --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 04bc53af12d9..decab9a8e4a8 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -2449,12 +2449,6 @@ static int atl1c_resume(struct device *dev) atl1c_reset_mac(>hw); atl1c_phy_init(>hw); -#if 0 - AT_READ_REG(>hw, REG_PM_CTRLSTAT, _data); - pm_data &= ~PM_CTRLSTAT_PME_EN; - AT_WRITE_REG(>hw, REG_PM_CTRLSTAT, pm_data); -#endif - netif_device_attach(netdev); if (netif_running(netdev)) atl1c_up(adapter); -- 2.21.1
[PATCH net-next] net: mlx4: remove unneeded variable "err" in mlx4_en_ethtool_add_mac_rule()
Fix the following coccicheck warning: drivers/net/ethernet/mellanox/mlx4/en_ethtool.c:1396:5-8: Unneeded variable: "err". Return "0" on line 1411 Signed-off-by: Jason Yan --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 216e6b2e9eed..b816154bc79a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -1392,7 +1392,6 @@ static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd, struct mlx4_spec_list *spec_l2, unsigned char *mac) { - int err = 0; __be64 mac_msk = cpu_to_be64(MLX4_MAC_MASK << 16); spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; @@ -1407,7 +1406,7 @@ static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd, list_add_tail(_l2->list, rule_list_h); - return err; + return 0; } static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, -- 2.21.1
[PATCH] drm/vmwgfx: Return true in function vmw_fence_obj_signaled()
Fix the following coccicheck warning: drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:518:9-10: WARNING: return of 0/1 in function 'vmw_fence_obj_signaled' with return type bool Signed-off-by: Jason Yan --- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index 178a6cd1a06f..0f8d29397157 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c @@ -515,7 +515,7 @@ bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence) struct vmw_fence_manager *fman = fman_from_fence(fence); if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, >base.flags)) - return 1; + return true; vmw_fences_update(fman); -- 2.21.1
[PATCH] USB: Remove dead code in usb_choose_configuration()
This code is dead for more than 10 years. Remove it. Signed-off-by: Jason Yan --- drivers/usb/core/generic.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index 4626227a6dd2..1c93192fc136 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -93,12 +93,6 @@ int usb_choose_configuration(struct usb_device *udev) * be reinstated when device firmwares become more reliable. * Don't hold your breath. */ -#if 0 - /* Rule out self-powered configs for a bus-powered device */ - if (bus_powered && (c->desc.bmAttributes & - USB_CONFIG_ATT_SELFPOWER)) - continue; -#endif /* * The next test may not be as effective as it should be. -- 2.21.1
[PATCH] b43: remove dead function b43_rssinoise_postprocess()
This function is dead for more than 10 years. Remove it. Signed-off-by: Jason Yan --- drivers/net/wireless/broadcom/b43/xmit.c | 13 - 1 file changed, 13 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/xmit.c b/drivers/net/wireless/broadcom/b43/xmit.c index 058745219516..55babc6d1091 100644 --- a/drivers/net/wireless/broadcom/b43/xmit.c +++ b/drivers/net/wireless/broadcom/b43/xmit.c @@ -629,19 +629,6 @@ static s8 b43_rssi_postprocess(struct b43_wldev *dev, return (s8) tmp; } -//TODO -#if 0 -static s8 b43_rssinoise_postprocess(struct b43_wldev *dev, u8 in_rssi) -{ - struct b43_phy *phy = >phy; - s8 ret; - - ret = b43_rssi_postprocess(dev, in_rssi, 0, 1, 1); - - return ret; -} -#endif - void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) { struct ieee80211_rx_status status; -- 2.21.1
[PATCH] kgdb: Return true in kgdb_nmi_poll_knock()
Fix the following coccicheck warning: include/linux/kgdb.h:301:54-55: WARNING: return of 0/1 in function 'kgdb_nmi_poll_knock' with return type bool Signed-off-by: Jason Yan --- include/linux/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index b072aeb1fd78..042828aeb73d 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -298,7 +298,7 @@ extern bool kgdb_nmi_poll_knock(void); #else static inline int kgdb_register_nmi_console(void) { return 0; } static inline int kgdb_unregister_nmi_console(void) { return 0; } -static inline bool kgdb_nmi_poll_knock(void) { return 1; } +static inline bool kgdb_nmi_poll_knock(void) { return true; } #endif extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); -- 2.21.1
[PATCH] drm/amd/display: remove variable "result" in dcn20_patch_unknown_plane_state()
Fix the following coccicheck warning: drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c:3216:16-22: Unneeded variable: "result". Return "DC_OK" on line 3229 Signed-off-by: Jason Yan --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c index 4dea550c3f83..3c0090797866 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -3228,8 +3228,6 @@ static struct dc_cap_funcs cap_funcs = { enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state) { - enum dc_status result = DC_OK; - enum surface_pixel_format surf_pix_format = plane_state->format; unsigned int bpp = resource_pixel_format_to_bpp(surf_pix_format); @@ -3241,7 +3239,7 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_stat swizzle = DC_SW_64KB_S; plane_state->tiling_info.gfx9.swizzle = swizzle; - return result; + return DC_OK; } static struct resource_funcs dcn20_res_pool_funcs = { -- 2.21.1
[PATCH] ata: return true in ata_is_host_link()
Fix the following coccicheck warning: include/linux/libata.h:1446:8-9: WARNING: return of 0/1 in function 'ata_is_host_link' with return type bool Signed-off-by: Jason Yan --- include/linux/libata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/libata.h b/include/linux/libata.h index 8bf5e59a7859..e05a8ed2e31e 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1443,7 +1443,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap) static inline bool ata_is_host_link(const struct ata_link *link) { - return 1; + return true; } #endif /* CONFIG_SATA_PMP */ -- 2.21.1
[PATCH] sched/fair: Return true,false in voluntary_active_balance()
Fix the following coccicheck warning: kernel/sched/fair.c:9375:9-10: WARNING: return of 0/1 in function 'voluntary_active_balance' with return type bool Signed-off-by: Jason Yan --- kernel/sched/fair.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b3bb4d6e49c3..e8390106ada4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9373,7 +9373,7 @@ voluntary_active_balance(struct lb_env *env) struct sched_domain *sd = env->sd; if (asym_active_balance(env)) - return 1; + return true; /* * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task. @@ -9385,13 +9385,13 @@ voluntary_active_balance(struct lb_env *env) (env->src_rq->cfs.h_nr_running == 1)) { if ((check_cpu_capacity(env->src_rq, sd)) && (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_cpu)*100)) - return 1; + return true; } if (env->migration_type == migrate_misfit) - return 1; + return true; - return 0; + return false; } static int need_active_balance(struct lb_env *env) -- 2.21.1
Re: [PATCH] MIPS: Lasat: Remove dead code in lasat.h
在 2020/5/7 16:38, Thomas Bogendoerfer 写道: On Wed, May 06, 2020 at 09:42:58PM +0800, Jason Yan wrote: This code has been marked dead for more than 10 years. Seems no need to keep it now. Signed-off-by: Jason Yan --- arch/mips/include/asm/lasat/lasat.h | 5 - 1 file changed, 5 deletions(-) I'll send a patch shortly to remove lasat completly. Therefore I'm not going to apply this cleanup patch. OK, thanks for letting me know this infomation. Jason Thomas.
[PATCH v2] bpf, i386: remove unneeded conversion to bool
The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning: arch/x86/net/bpf_jit_comp32.c:1478:50-55: WARNING: conversion to bool not needed here arch/x86/net/bpf_jit_comp32.c:1479:50-55: WARNING: conversion to bool not needed here Signed-off-by: Jason Yan --- v2: change the name 'x32' to 'i386'. arch/x86/net/bpf_jit_comp32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c index 66cd150b7e54..96fde03aa987 100644 --- a/arch/x86/net/bpf_jit_comp32.c +++ b/arch/x86/net/bpf_jit_comp32.c @@ -1475,8 +1475,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, for (i = 0; i < insn_cnt; i++, insn++) { const s32 imm32 = insn->imm; const bool is64 = BPF_CLASS(insn->code) == BPF_ALU64; - const bool dstk = insn->dst_reg == BPF_REG_AX ? false : true; - const bool sstk = insn->src_reg == BPF_REG_AX ? false : true; + const bool dstk = insn->dst_reg != BPF_REG_AX; + const bool sstk = insn->src_reg != BPF_REG_AX; const u8 code = insn->code; const u8 *dst = bpf2ia32[insn->dst_reg]; const u8 *src = bpf2ia32[insn->src_reg]; -- 2.21.1
[PATCH] MIPS: Octeon: Remove dead code in __cvmx_helper_npi_probe()
This code has been marked dead for more than 10 years. Seems no need to keep it now. Signed-off-by: Jason Yan --- arch/mips/cavium-octeon/executive/cvmx-helper-npi.c | 12 1 file changed, 12 deletions(-) diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-npi.c b/arch/mips/cavium-octeon/executive/cvmx-helper-npi.c index cc94cfa545b4..cb210d2ef0c4 100644 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-npi.c +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-npi.c @@ -59,18 +59,6 @@ int __cvmx_helper_npi_probe(int interface) && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) /* The packet engines didn't exist before pass 2 */ return 4; -#if 0 - /* -* Technically CN30XX, CN31XX, and CN50XX contain packet -* engines, but nobody ever uses them. Since this is the case, -* we disable them here. -*/ - else if (OCTEON_IS_MODEL(OCTEON_CN31XX) -|| OCTEON_IS_MODEL(OCTEON_CN50XX)) - return 2; - else if (OCTEON_IS_MODEL(OCTEON_CN30XX)) - return 1; -#endif #endif return 0; } -- 2.21.1
[PATCH] MIPS: Remove dead code in pci.h
This code has been marked dead for more than 10 years. Seems no need to keep it now. Signed-off-by: Jason Yan --- arch/mips/include/asm/mach-rc32434/pci.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/include/asm/mach-rc32434/pci.h b/arch/mips/include/asm/mach-rc32434/pci.h index 6f40d1515580..9a6eefd12757 100644 --- a/arch/mips/include/asm/mach-rc32434/pci.h +++ b/arch/mips/include/asm/mach-rc32434/pci.h @@ -319,9 +319,6 @@ struct pci_msu { #define PCIM_H_EA 0x3 #define PCIM_H_IA_FIX 0x4 #define PCIM_H_IA_RR 0x5 -#if 0 -#define PCI_ADDR_START 0x1300 -#endif #define PCI_ADDR_START 0x5000 -- 2.21.1
[PATCH] MIPS: Lasat: Remove dead code in lasat.h
This code has been marked dead for more than 10 years. Seems no need to keep it now. Signed-off-by: Jason Yan --- arch/mips/include/asm/lasat/lasat.h | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/mips/include/asm/lasat/lasat.h b/arch/mips/include/asm/lasat/lasat.h index 483be606960d..7659818f6553 100644 --- a/arch/mips/include/asm/lasat/lasat.h +++ b/arch/mips/include/asm/lasat/lasat.h @@ -121,11 +121,6 @@ struct lasat_eeprom_struct_pre7 { #define LASAT_BMID_SAFEPIPE50005 #define LASAT_BMID_SAFEPIPE70006 #define LASAT_BMID_SAFEPIPE10007 -#if 0 -#define LASAT_BMID_SAFEPIPE30 7 -#define LASAT_BMID_SAFEPIPE51008 -#define LASAT_BMID_SAFEPIPE71009 -#endif #define LASAT_BMID_UNKNOWN 0xf #define LASAT_MAX_BMID_NAMES 9 /* no larger than 15! */ -- 2.21.1
[PATCH] MIPS: CFE: Remove dead code in cfe_getfwinfo()
This code has been marked dead since the beginning of the git history. Seems no need to keep it now. Signed-off-by: Jason Yan --- arch/mips/fw/cfe/cfe_api.c | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/mips/fw/cfe/cfe_api.c b/arch/mips/fw/cfe/cfe_api.c index c020b29f561c..0c9c97ab291e 100644 --- a/arch/mips/fw/cfe/cfe_api.c +++ b/arch/mips/fw/cfe/cfe_api.c @@ -243,11 +243,6 @@ int cfe_getfwinfo(cfe_fwinfo_t * info) info->fwi_bootarea_pa = xiocb.plist.xiocb_fwinfo.fwi_bootarea_pa; info->fwi_bootarea_size = xiocb.plist.xiocb_fwinfo.fwi_bootarea_size; -#if 0 - info->fwi_reserved1 = xiocb.plist.xiocb_fwinfo.fwi_reserved1; - info->fwi_reserved2 = xiocb.plist.xiocb_fwinfo.fwi_reserved2; - info->fwi_reserved3 = xiocb.plist.xiocb_fwinfo.fwi_reserved3; -#endif return 0; } -- 2.21.1
Re: [PATCH] ARM: OMAP2+: remove unneeded variable "errata" in configure_dma_errata()
在 2020/5/6 16:29, Russell King - ARM Linux admin 写道: On Wed, May 06, 2020 at 02:19:00PM +0800, Jason Yan wrote: Fix the following coccicheck warning: arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161 NAK. Look closer at what the code is doing, thanks. This warning is basically incorrect. OK, the macro SET_DMA_ERRATA is using this variable.
[PATCH] dma-buf: heaps: Remove Unneeded variable "ret" in dma_heap_dma_buf_begin_cpu_access()
Fix the following coccicheck warning: drivers/dma-buf/heaps/heap-helpers.c:203:5-8: Unneeded variable: "ret". Return "0" on line 216 Signed-off-by: Jason Yan --- drivers/dma-buf/heaps/heap-helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c index 9f964ca3f59c..c82872501ba2 100644 --- a/drivers/dma-buf/heaps/heap-helpers.c +++ b/drivers/dma-buf/heaps/heap-helpers.c @@ -200,7 +200,6 @@ static int dma_heap_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, { struct heap_helper_buffer *buffer = dmabuf->priv; struct dma_heaps_attachment *a; - int ret = 0; mutex_lock(>lock); @@ -213,7 +212,7 @@ static int dma_heap_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, } mutex_unlock(>lock); - return ret; + return 0; } static int dma_heap_dma_buf_end_cpu_access(struct dma_buf *dmabuf, -- 2.21.1
[PATCH] spi: a3700: make a3700_spi_init() return void
Fix the following coccicheck warning: drivers/spi/spi-armada-3700.c:283:8-11: Unneeded variable: "ret". Return "0" on line 315 Signed-off-by: Jason Yan --- drivers/spi/spi-armada-3700.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index e450ee17787f..fcde419e480c 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c @@ -276,11 +276,11 @@ static int a3700_spi_fifo_flush(struct a3700_spi *a3700_spi) return -ETIMEDOUT; } -static int a3700_spi_init(struct a3700_spi *a3700_spi) +static void a3700_spi_init(struct a3700_spi *a3700_spi) { struct spi_master *master = a3700_spi->master; u32 val; - int i, ret = 0; + int i; /* Reset SPI unit */ val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); @@ -311,8 +311,6 @@ static int a3700_spi_init(struct a3700_spi *a3700_spi) /* Mask the interrupts and clear cause bits */ spireg_write(a3700_spi, A3700_SPI_INT_MASK_REG, 0); spireg_write(a3700_spi, A3700_SPI_INT_STAT_REG, ~0U); - - return ret; } static irqreturn_t a3700_spi_interrupt(int irq, void *dev_id) @@ -886,9 +884,7 @@ static int a3700_spi_probe(struct platform_device *pdev) master->min_speed_hz = DIV_ROUND_UP(clk_get_rate(spi->clk), A3700_SPI_MAX_PRESCALE); - ret = a3700_spi_init(spi); - if (ret) - goto error_clk; + a3700_spi_init(spi); ret = devm_request_irq(dev, spi->irq, a3700_spi_interrupt, 0, dev_name(dev), master); -- 2.21.1
[PATCH] ARM: OMAP2+: remove unneeded variable "errata" in configure_dma_errata()
Fix the following coccicheck warning: arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161 Signed-off-by: Jason Yan --- arch/arm/mach-omap2/dma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index 8cc109cc242a..ef5022bc91a2 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c @@ -79,8 +79,6 @@ static const struct omap_dma_reg reg_map[] = { static unsigned configure_dma_errata(void) { - unsigned errata = 0; - /* * Errata applicable for OMAP2430ES1.0 and all omap2420 * @@ -158,7 +156,7 @@ static unsigned configure_dma_errata(void) if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP)) SET_DMA_ERRATA(DMA_ROMCODE_BUG); - return errata; + return 0; } static const struct dma_slave_map omap24xx_sdma_dt_map[] = { -- 2.21.1
[PATCH net-next] i40e: Make i40e_shutdown_adminq() return void
Fix the following coccicheck warning: drivers/net/ethernet/intel/i40e/i40e_adminq.c:699:13-21: Unneeded variable: "ret_code". Return "0" on line 710 Signed-off-by: Jason Yan --- drivers/net/ethernet/intel/i40e/i40e_adminq.c| 6 +- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c index 37514a75f928..6a089848c857 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c @@ -694,10 +694,8 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw) * i40e_shutdown_adminq - shutdown routine for the Admin Queue * @hw: pointer to the hardware structure **/ -i40e_status i40e_shutdown_adminq(struct i40e_hw *hw) +void i40e_shutdown_adminq(struct i40e_hw *hw) { - i40e_status ret_code = 0; - if (i40e_check_asq_alive(hw)) i40e_aq_queue_shutdown(hw, true); @@ -706,8 +704,6 @@ i40e_status i40e_shutdown_adminq(struct i40e_hw *hw) if (hw->nvm_buff.va) i40e_free_virt_mem(hw, >nvm_buff); - - return ret_code; } /** diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index bbb478f09093..5c1378641b3b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h @@ -17,7 +17,7 @@ /* adminq functions */ i40e_status i40e_init_adminq(struct i40e_hw *hw); -i40e_status i40e_shutdown_adminq(struct i40e_hw *hw); +void i40e_shutdown_adminq(struct i40e_hw *hw); void i40e_adminq_init_ring_data(struct i40e_hw *hw); i40e_status i40e_clean_arq_element(struct i40e_hw *hw, struct i40e_arq_event_info *e, -- 2.21.1
[PATCH] video: fbdev: pxa168fb: make pxa168fb_init_mode() return void
No other functions use the return value of pxa168fb_init_mode() and the return value is always 0 now. Make it return void. This fixes the following coccicheck warning: drivers/video/fbdev/pxa168fb.c:565:5-8: Unneeded variable: "ret". Return "0" on line 597 Signed-off-by: Jason Yan --- drivers/video/fbdev/pxa168fb.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c index aef8a3042590..eedfbd3572a8 100644 --- a/drivers/video/fbdev/pxa168fb.c +++ b/drivers/video/fbdev/pxa168fb.c @@ -557,12 +557,11 @@ static const struct fb_ops pxa168fb_ops = { .fb_imageblit = cfb_imageblit, }; -static int pxa168fb_init_mode(struct fb_info *info, +static void pxa168fb_init_mode(struct fb_info *info, struct pxa168fb_mach_info *mi) { struct pxa168fb_info *fbi = info->par; struct fb_var_screeninfo *var = >var; - int ret = 0; u32 total_w, total_h, refresh; u64 div_result; const struct fb_videomode *m; @@ -593,8 +592,6 @@ static int pxa168fb_init_mode(struct fb_info *info, div_result = 1ll; do_div(div_result, total_w * total_h * refresh); var->pixclock = (u32)div_result; - - return ret; } static int pxa168fb_probe(struct platform_device *pdev) -- 2.21.1
[PATCH] scsi: qla2xxx: make qlafx00_process_aen() return void
No other functions use the return value of qlafx00_process_aen() and the return value is always 0 now. Make it return void. This fixes the following coccicheck warning: drivers/scsi/qla2xxx/qla_mr.c:1716:5-9: Unneeded variable: "rval". Return "0" on line 1768 Signed-off-by: Jason Yan --- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_mr.c | 5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index b20c5fa122fb..f62b71e47581 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -771,7 +771,7 @@ extern int qlafx00_fw_ready(scsi_qla_host_t *); extern int qlafx00_configure_devices(scsi_qla_host_t *); extern int qlafx00_reset_initialize(scsi_qla_host_t *); extern int qlafx00_fx_disc(scsi_qla_host_t *, fc_port_t *, uint16_t); -extern int qlafx00_process_aen(struct scsi_qla_host *, struct qla_work_evt *); +extern void qlafx00_process_aen(struct scsi_qla_host *, struct qla_work_evt *); extern int qlafx00_post_aenfx_work(struct scsi_qla_host *, uint32_t, uint32_t *, int); extern uint32_t qlafx00_fw_state_show(struct device *, diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index df99911b8bb9..ce98189c7872 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -1710,10 +1710,9 @@ qlafx00_tgt_detach(struct scsi_qla_host *vha, int tgt_id) return; } -int +void qlafx00_process_aen(struct scsi_qla_host *vha, struct qla_work_evt *evt) { - int rval = 0; uint32_t aen_code, aen_data; aen_code = FCH_EVT_VENDOR_UNIQUE; @@ -1764,8 +1763,6 @@ qlafx00_process_aen(struct scsi_qla_host *vha, struct qla_work_evt *evt) fc_host_post_event(vha->host, fc_get_event_number(), aen_code, aen_data); - - return rval; } static void -- 2.21.1
[PATCH] tty: mxser: make mxser_change_speed() return void
No other functions use the return value of mxser_change_speed() and the return value is always 0 now. Make it return void. This fixes the following coccicheck warning: drivers/tty/mxser.c:645:5-8: Unneeded variable: "ret". Return "0" on line 650 Signed-off-by: Jason Yan --- drivers/tty/mxser.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 9d00ff5ef961..3703987c4666 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -638,16 +638,15 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd) * This routine is called to set the UART divisor registers to match * the specified baud rate for a serial port. */ -static int mxser_change_speed(struct tty_struct *tty) +static void mxser_change_speed(struct tty_struct *tty) { struct mxser_port *info = tty->driver_data; unsigned cflag, cval, fcr; - int ret = 0; unsigned char status; cflag = tty->termios.c_cflag; if (!info->ioaddr) - return ret; + return; if (mxser_set_baud_method[tty->index] == 0) mxser_set_baud(tty, tty_get_baud_rate(tty)); @@ -803,8 +802,6 @@ static int mxser_change_speed(struct tty_struct *tty) outb(fcr, info->ioaddr + UART_FCR); /* set fcr */ outb(cval, info->ioaddr + UART_LCR); - - return ret; } static void mxser_check_modem_status(struct tty_struct *tty, -- 2.21.1
[PATCH] ALSA: hda: Return true,false for return type bool
Fix the following coccicheck warning: include/sound/hdaudio.h:210:73-74: WARNING: return of 0/1 in function 'snd_hdac_is_in_pm' with return type bool include/sound/hdaudio.h:211:76-77: WARNING: return of 0/1 in function 'snd_hdac_is_power_on' with return type bool Signed-off-by: Jason Yan --- include/sound/hdaudio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index d365297b3698..10945963d727 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -207,8 +207,8 @@ static inline int snd_hdac_power_down_pm(struct hdac_device *codec) { return 0; static inline int snd_hdac_keep_power_up(struct hdac_device *codec) { return 0; } static inline void snd_hdac_enter_pm(struct hdac_device *codec) {} static inline void snd_hdac_leave_pm(struct hdac_device *codec) {} -static inline bool snd_hdac_is_in_pm(struct hdac_device *codec) { return 0; } -static inline bool snd_hdac_is_power_on(struct hdac_device *codec) { return 1; } +static inline bool snd_hdac_is_in_pm(struct hdac_device *codec) { return false; } +static inline bool snd_hdac_is_power_on(struct hdac_device *codec) { return true; } #endif /* -- 2.21.1
[PATCH] regulator: db8500-prcmu: Use true,false for bool variable
Fix the following coccicheck warning: drivers/regulator/db8500-prcmu.c:184:1-17: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/regulator/db8500-prcmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c index 88a2dcb9fe8a..0ce6ec4933af 100644 --- a/drivers/regulator/db8500-prcmu.c +++ b/drivers/regulator/db8500-prcmu.c @@ -181,7 +181,7 @@ static int db8500_regulator_switch_disable(struct regulator_dev *rdev) goto out; } - info->is_enabled = 0; + info->is_enabled = false; out: return ret; } -- 2.21.1
[PATCH] sparc: mm: return true,false in kern_addr_valid()
This function's return type is bool and returns both true/false and 0/1. This fixes the following coccicheck warning: arch/sparc/mm/init_64.c:1652:9-10: WARNING: return of 0/1 in function 'kern_addr_valid' with return type bool Signed-off-by: Jason Yan --- arch/sparc/mm/init_64.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 5774529ceb43..2ef6826a6ca6 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -1649,29 +1649,29 @@ bool kern_addr_valid(unsigned long addr) pgd = pgd_offset_k(addr); if (pgd_none(*pgd)) - return 0; + return false; p4d = p4d_offset(pgd, addr); if (p4d_none(*p4d)) - return 0; + return false; pud = pud_offset(p4d, addr); if (pud_none(*pud)) - return 0; + return false; if (pud_large(*pud)) return pfn_valid(pud_pfn(*pud)); pmd = pmd_offset(pud, addr); if (pmd_none(*pmd)) - return 0; + return false; if (pmd_large(*pmd)) return pfn_valid(pmd_pfn(*pmd)); pte = pte_offset_kernel(pmd, addr); if (pte_none(*pte)) - return 0; + return false; return pfn_valid(pte_pfn(*pte)); } -- 2.21.1
[PATCH net-next] net: mlx4: remove unneeded variable "err" in mlx4_en_get_rxfh()
Fix the following coccicheck warning: drivers/net/ethernet/mellanox/mlx4/en_ethtool.c:1238:5-8: Unneeded variable: "err". Return "0" on line 1252 Signed-off-by: Jason Yan --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 8a5ea2543670..216e6b2e9eed 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -1235,7 +1235,6 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, struct mlx4_en_priv *priv = netdev_priv(dev); u32 n = mlx4_en_get_rxfh_indir_size(dev); u32 i, rss_rings; - int err = 0; rss_rings = priv->prof->rss_rings ?: n; rss_rings = rounddown_pow_of_two(rss_rings); @@ -1249,7 +1248,7 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, memcpy(key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE); if (hfunc) *hfunc = priv->rss_hash_fn; - return err; + return 0; } static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, -- 2.21.1
[PATCH net-next] net: bridge: return false in br_mrp_enabled()
Fix the following coccicheck warning: net/bridge/br_private.h:1334:8-9: WARNING: return of 0/1 in function 'br_mrp_enabled' with return type bool Signed-off-by: Jason Yan --- net/bridge/br_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index c35647cb138a..78d3a951180d 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1331,7 +1331,7 @@ static inline int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb) static inline bool br_mrp_enabled(struct net_bridge *br) { - return 0; + return false; } static inline void br_mrp_port_del(struct net_bridge *br, -- 2.21.1
[PATCH net-next] net: ethernet: ti: use true,false for bool variables in cpsw_new.c
Fix the following coccicheck warning: drivers/net/ethernet/ti/cpsw_new.c:1924:2-17: WARNING: Assignment of 0/1 to bool variable drivers/net/ethernet/ti/cpsw_new.c:1231:1-16: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/net/ethernet/ti/cpsw_new.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 33c8dd686206..dce49311d3d3 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1228,7 +1228,7 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw) data->active_slave = 0; data->channels = CPSW_MAX_QUEUES; data->ale_entries = CPSW_ALE_NUM_ENTRIES; - data->dual_emac = 1; + data->dual_emac = true; data->bd_ram_size = CPSW_BD_RAM_SIZE; data->mac_control = 0; @@ -1921,7 +1921,7 @@ static int cpsw_probe(struct platform_device *pdev) soc = soc_device_match(cpsw_soc_devices); if (soc) - cpsw->quirk_irq = 1; + cpsw->quirk_irq = true; cpsw->rx_packet_max = rx_packet_max; cpsw->descs_pool_size = descs_pool_size; -- 2.21.1
[PATCH net-next] net: atheros: remove conversion to bool in atl1c_start_mac()
No need to convert '==' expression to bool. This fixes the following coccicheck warning: drivers/net/ethernet/atheros/atl1c/atl1c_main.c:1189:63-68: WARNING: conversion to bool not needed here Signed-off-by: Jason Yan --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 00bd7bd55794..04bc53af12d9 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -1186,7 +1186,7 @@ static void atl1c_start_mac(struct atl1c_adapter *adapter) struct atl1c_hw *hw = >hw; u32 mac, txq, rxq; - hw->mac_duplex = adapter->link_duplex == FULL_DUPLEX ? true : false; + hw->mac_duplex = adapter->link_duplex == FULL_DUPLEX; hw->mac_speed = adapter->link_speed == SPEED_1000 ? atl1c_mac_speed_1000 : atl1c_mac_speed_10_100; -- 2.21.1
[PATCH net-next] net: agere: use true,false for bool variable
Fix the following coccicheck warning: drivers/net/ethernet/agere/et131x.c:717:3-22: WARNING: Assignment of 0/1 to bool variable drivers/net/ethernet/agere/et131x.c:721:1-20: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/net/ethernet/agere/et131x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c index 1b19385ad8a9..865892c1f23f 100644 --- a/drivers/net/ethernet/agere/et131x.c +++ b/drivers/net/ethernet/agere/et131x.c @@ -714,11 +714,11 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) * gather additional information that normally would * come from the eeprom, like MAC Address */ - adapter->has_eeprom = 0; + adapter->has_eeprom = false; return -EIO; } } - adapter->has_eeprom = 1; + adapter->has_eeprom = true; /* Read the EEPROM for information regarding LED behavior. Refer to * et131x_xcvr_init() for its use. -- 2.21.1
[PATCH net-next] net: bnxt: Remove Comparison to bool in bnxt_ethtool.c
Fix the following coccicheck warning: drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:1991:5-46: WARNING: Comparison to bool drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:1993:10-54: WARNING: Comparison to bool drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2380:5-38: WARNING: Comparison to bool Signed-off-by: Jason Yan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 34046a6286e8..75f60aea8dec 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1988,9 +1988,9 @@ static int bnxt_flash_firmware_from_file(struct net_device *dev, rc, filename); return rc; } - if (bnxt_dir_type_is_ape_bin_format(dir_type) == true) + if (bnxt_dir_type_is_ape_bin_format(dir_type)) rc = bnxt_flash_firmware(dev, dir_type, fw->data, fw->size); - else if (bnxt_dir_type_is_other_exec_format(dir_type) == true) + else if (bnxt_dir_type_is_other_exec_format(dir_type)) rc = bnxt_flash_microcode(dev, dir_type, fw->data, fw->size); else rc = bnxt_flash_nvram(dev, dir_type, BNX_DIR_ORDINAL_FIRST, @@ -2377,7 +2377,7 @@ static int bnxt_set_eeprom(struct net_device *dev, } /* Create or re-write an NVM item: */ - if (bnxt_dir_type_is_executable(type) == true) + if (bnxt_dir_type_is_executable(type)) return -EOPNOTSUPP; ext = eeprom->magic & 0x; ordinal = eeprom->offset >> 16; -- 2.21.1
[PATCH net-next] net: qede: Use true for bool variable in qede_init_fp()
Fix the following coccicheck warning: drivers/net/ethernet/qlogic/qede/qede_main.c:1717:5-19: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index 9b456198cb50..256506024b88 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c @@ -1714,7 +1714,7 @@ static void qede_init_fp(struct qede_dev *edev) txq->ndev_txq_id = ndev_tx_id; if (edev->dev_info.is_legacy) - txq->is_legacy = 1; + txq->is_legacy = true; txq->dev = >pdev->dev; } -- 2.21.1
[PATCH net-next] qlcnic: use true,false for bool variable in qlcnic_sriov_common.c
Fix the following coccicheck warning: drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c:1585:3-25: WARNING: Assignment of 0/1 to bool variable drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c:1588:3-25: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index f7c2f32237cb..7adbb03cb931 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -1582,10 +1582,10 @@ void qlcnic_sriov_vf_set_multi(struct net_device *netdev) if (mode == VPORT_MISS_MODE_ACCEPT_ALL && !adapter->fdb_mac_learn) { qlcnic_alloc_lb_filters_mem(adapter); - adapter->drv_mac_learn = 1; + adapter->drv_mac_learn = true; adapter->rx_mac_learn = true; } else { - adapter->drv_mac_learn = 0; + adapter->drv_mac_learn = false; adapter->rx_mac_learn = false; } } -- 2.21.1
[PATCH net-next] bnx2x: Remove Comparison to bool in bnx2x_dcb.c
Fix the following coccicheck warning: drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1548:17-31: WARNING: Comparison to bool drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1148:16-24: WARNING: Comparison to bool drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1158:30-38: WARNING: Comparison to bool Signed-off-by: Jason Yan --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 2c6ba046d2a8..17ae6df90723 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c @@ -1145,7 +1145,7 @@ static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp, break; } } - if (false == pg_found) { + if (!pg_found) { data[help_data->num_of_pg].pg = add_pg; data[help_data->num_of_pg].pg_priority = (1 << ttp[add_traf_type]); @@ -1155,7 +1155,7 @@ static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp, } DP(BNX2X_MSG_DCB, "add_traf_type %d pg_found %s num_of_pg %d\n", - add_traf_type, (false == pg_found) ? "NO" : "YES", + add_traf_type, !pg_found ? "NO" : "YES", help_data->num_of_pg); } } @@ -1544,8 +1544,7 @@ static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params( if (pg_entry < DCBX_MAX_NUM_PG_BW_ENTRIES) { entry = 0; - if (i == (num_of_pri-1) && - false == b_found_strict) + if (i == (num_of_pri-1) && !b_found_strict) /* last entry will be handled separately * If no priority is strict than last * entry goes to last queue. -- 2.21.1
[PATCH net-next] ixgbe: Use true,false for bool variable in __ixgbe_enable_sriov()
Fix the following coccicheck warning: drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c:105:2-38: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Jason Yan --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 537dfff585e0..d05a5690e66b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -102,7 +102,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter, * indirection table and RSS hash key with PF therefore * we want to disable the querying by default. */ - adapter->vfinfo[i].rss_query_enabled = 0; + adapter->vfinfo[i].rss_query_enabled = false; /* Untrust all VFs */ adapter->vfinfo[i].trusted = false; -- 2.21.1
[PATCH net-next] ixgbe: Remove conversion to bool in ixgbe_device_supports_autoneg_fc()
No need to convert '==' expression to bool. This fixes the following coccicheck warning: drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:68:11-16: WARNING: conversion to bool not needed here Signed-off-by: Jason Yan --- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index 0bd1294ba517..2d896d663e3d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c @@ -64,8 +64,7 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) hw->mac.ops.check_link(hw, , _up, false); /* if link is down, assume supported */ if (link_up) - supported = speed == IXGBE_LINK_SPEED_1GB_FULL ? - true : false; + supported = speed == IXGBE_LINK_SPEED_1GB_FULL; else supported = true; } -- 2.21.1
[PATCH] scsi: bfa: make bfad_iocmd_ioc_get_stats() static
Fix the following sparse warning: drivers/scsi/bfa/bfad_bsg.c:140:1: warning: symbol 'bfad_iocmd_ioc_get_stats' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/scsi/bfa/bfad_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index a76c968dbac5..412dbe125e10 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -136,7 +136,7 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *bfad, void *cmd) return 0; } -int +static int bfad_iocmd_ioc_get_stats(struct bfad_s *bfad, void *cmd) { struct bfa_bsg_ioc_stats_s *iocmd = (struct bfa_bsg_ioc_stats_s *)cmd; -- 2.21.1