[PATCH -next v2] coresight: replicator: Add terminate entry for acpi_device_id tables
Make sure acpi_device_id tables have terminate entry. Fixes: fe446287ec9f ("coresight: acpi: Support for platform devices") Signed-off-by: Wei Yongjun Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-replicator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 542952759941..b7d6d59d56db 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -300,6 +300,7 @@ static const struct of_device_id static_replicator_match[] = { #ifdef CONFIG_ACPI static const struct acpi_device_id static_replicator_acpi_ids[] = { {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ + {} }; #endif
[PATCH -next] coresight: replicator: Add terminate entry for acpi_device_id tables
Make sure acpi_device_id tables have terminate entry. Fixes: 8f35caae1e1f ("coresight: acpi: Support for platform devices") Signed-off-by: Wei Yongjun --- drivers/hwtracing/coresight/coresight-replicator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 542952759941..0c73dc1073c0 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -300,6 +300,7 @@ static const struct of_device_id static_replicator_match[] = { #ifdef CONFIG_ACPI static const struct acpi_device_id static_replicator_acpi_ids[] = { {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ + {"", 0}, }; #endif
[PATCH -next] ocxl: Fix return value check in afu_ioctl()
In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). This issue was detected by using the Coccinelle software. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Signed-off-by: Wei Yongjun --- drivers/misc/ocxl/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 8aa22893ed76..2870c25da166 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -257,8 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd, return -EINVAL; irq_id = ocxl_irq_offset_to_id(ctx, irq_fd.irq_offset); ev_ctx = eventfd_ctx_fdget(irq_fd.eventfd); - if (!ev_ctx) - return -EFAULT; + if (IS_ERR(ev_ctx)) + return PTR_ERR(ev_ctx); rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx); break;
[PATCH -next] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items
Since we will remove items off the list using list_del() we need to use a safe version of the list_for_each_entry() macro aptly named list_for_each_entry_safe(). Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support") Signed-off-by: Wei Yongjun --- sound/soc/sprd/sprd-mcdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c index 28f5e649733d..df250f7f2b6f 100644 --- a/sound/soc/sprd/sprd-mcdt.c +++ b/sound/soc/sprd/sprd-mcdt.c @@ -978,12 +978,12 @@ static int sprd_mcdt_probe(struct platform_device *pdev) static int sprd_mcdt_remove(struct platform_device *pdev) { - struct sprd_mcdt_chan *temp; + struct sprd_mcdt_chan *chan, *temp; mutex_lock(_mcdt_list_mutex); - list_for_each_entry(temp, _mcdt_chan_list, list) - list_del(>list); + list_for_each_entry_safe(chan, temp, _mcdt_chan_list, list) + list_del(>list); mutex_unlock(_mcdt_list_mutex);
[PATCH -next] ASoC: sprd: Fix return value check in sprd_mcdt_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support") Signed-off-by: Wei Yongjun --- sound/soc/sprd/sprd-mcdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c index 28f5e649733d..e9318d7a4810 100644 --- a/sound/soc/sprd/sprd-mcdt.c +++ b/sound/soc/sprd/sprd-mcdt.c @@ -951,8 +951,8 @@ static int sprd_mcdt_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mcdt->base = devm_ioremap_resource(>dev, res); - if (!mcdt->base) - return -ENOMEM; + if (IS_ERR(mcdt->base)) + return PTR_ERR(mcdt->base); mcdt->dev = >dev; spin_lock_init(>lock);
[PATCH -next] regulator: stm32-pwr: Make some symbols static
Fixes the following sparse warnings: drivers/regulator/stm32-pwr.c:35:5: warning: symbol 'ready_mask_table' was not declared. Should it be static? drivers/regulator/stm32-pwr.c:47:5: warning: symbol 'stm32_pwr_reg_is_ready' was not declared. Should it be static? drivers/regulator/stm32-pwr.c:57:5: warning: symbol 'stm32_pwr_reg_is_enabled' was not declared. Should it be static? Fixes: 6cdae8173f67 ("regulator: Add support for stm32 power regulators") Signed-off-by: Wei Yongjun --- drivers/regulator/stm32-pwr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c index e434b26d4c8b..222d593d76a2 100644 --- a/drivers/regulator/stm32-pwr.c +++ b/drivers/regulator/stm32-pwr.c @@ -32,7 +32,7 @@ enum { STM32PWR_REG_NUM_REGS }; -u32 ready_mask_table[STM32PWR_REG_NUM_REGS] = { +static u32 ready_mask_table[STM32PWR_REG_NUM_REGS] = { [PWR_REG11] = REG_1_1_RDY, [PWR_REG18] = REG_1_8_RDY, [PWR_USB33] = USB_3_3_RDY, @@ -44,7 +44,7 @@ struct stm32_pwr_reg { u32 ready_mask; }; -int stm32_pwr_reg_is_ready(struct regulator_dev *rdev) +static int stm32_pwr_reg_is_ready(struct regulator_dev *rdev) { struct stm32_pwr_reg *priv = rdev_get_drvdata(rdev); u32 val; @@ -54,7 +54,7 @@ int stm32_pwr_reg_is_ready(struct regulator_dev *rdev) return (val & priv->ready_mask); } -int stm32_pwr_reg_is_enabled(struct regulator_dev *rdev) +static int stm32_pwr_reg_is_enabled(struct regulator_dev *rdev) { struct stm32_pwr_reg *priv = rdev_get_drvdata(rdev); u32 val;
[PATCH -next] regulator: stm32-pwr: Fix return value check in stm32_pwr_regulator_probe()
In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 6cdae8173f67 ("regulator: Add support for stm32 power regulators") Signed-off-by: Wei Yongjun --- drivers/regulator/stm32-pwr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c index e434b26d4c8b..d4b9d6accfad 100644 --- a/drivers/regulator/stm32-pwr.c +++ b/drivers/regulator/stm32-pwr.c @@ -140,9 +140,9 @@ static int stm32_pwr_regulator_probe(struct platform_device *pdev) int i, ret = 0; base = of_iomap(np, 0); - if (IS_ERR(base)) { + if (!base) { dev_err(>dev, "Unable to map IO memory\n"); - return PTR_ERR(base); + return -ENOMEM; } config.dev = >dev;
[PATCH -next] phy: tegra: xusb: fix typo in tegra186_usb2_pad_probe()
Fix a typo in tegra186_usb2_pad_probe(), 'usb2->clk' should be 'priv->usb2_trk_clk'. Fixes: b8998e928030 ("phy: tegra: xusb: Add Tegra186 support") Signed-off-by: Wei Yongjun --- drivers/phy/tegra/xusb-tegra186.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index 11ad6e4e4711..a627fe0b8e54 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -467,8 +467,8 @@ tegra186_usb2_pad_probe(struct tegra_xusb_padctl *padctl, } priv->usb2_trk_clk = devm_clk_get(>dev, "trk"); - if (IS_ERR(usb2->clk)) { - err = PTR_ERR(usb2->clk); + if (IS_ERR(priv->usb2_trk_clk)) { + err = PTR_ERR(priv->usb2_trk_clk); dev_dbg(>dev, "failed to get usb2 trk clock: %d\n", err); goto unregister; }
[PATCH -next] device-dax: Make function 'dev_dax_kmem_probe' static
Fixes the following sparse warning: drivers/dax/kmem.c:17:5: warning: symbol 'dev_dax_kmem_probe' was not declared. Should it be static? Fixes: c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM") Signed-off-by: Wei Yongjun --- drivers/dax/kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a02318c6d28a..e5cbbe22a19b 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -14,7 +14,7 @@ #include "dax-private.h" #include "bus.h" -int dev_dax_kmem_probe(struct device *dev) +static int dev_dax_kmem_probe(struct device *dev) { struct dev_dax *dev_dax = to_dev_dax(dev); struct resource *res = _dax->region->res;
[PATCH -next] habanalabs: use GFP_ATOMIC under spin lock
A spin lock is taken here so we should use GFP_ATOMIC. Fixes: 0feaf86d4e69 ("habanalabs: add virtual memory and MMU modules") Signed-off-by: Wei Yongjun --- drivers/misc/habanalabs/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c index 9236e52852c6..9e3491dc3b55 100644 --- a/drivers/misc/habanalabs/memory.c +++ b/drivers/misc/habanalabs/memory.c @@ -120,7 +120,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, spin_lock(>idr_lock); handle = idr_alloc(>phys_pg_pack_handles, phys_pg_pack, 1, 0, - GFP_KERNEL); + GFP_ATOMIC); spin_unlock(>idr_lock); if (handle < 0) {
[PATCH -next] ASoC: cs35l36: Make some symbols static
Fixes the following sparse warnings: sound/soc/codecs/cs35l36.c:135:20: warning: symbol 'cs35l36_reg' was not declared. Should it be static? sound/soc/codecs/cs35l36.c:248:6: warning: symbol 'cs35l36_readable_reg' was not declared. Should it be static? sound/soc/codecs/cs35l36.c:398:6: warning: symbol 'cs35l36_precious_reg' was not declared. Should it be static? sound/soc/codecs/cs35l36.c:410:6: warning: symbol 'cs35l36_volatile_reg' was not declared. Should it be static? Fixes: 6ba9dd6c893b ("ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier") Signed-off-by: Wei Yongjun --- sound/soc/codecs/cs35l36.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c index 4f880a678812..005f1adc80b8 100644 --- a/sound/soc/codecs/cs35l36.c +++ b/sound/soc/codecs/cs35l36.c @@ -132,7 +132,7 @@ static const struct cs35l36_pll_config cs35l36_pll_sysclk[] = { {2700, 0x3F, 0x0A}, }; -struct reg_default cs35l36_reg[] = { +static struct reg_default cs35l36_reg[] = { {CS35L36_TESTKEY_CTRL, 0x}, {CS35L36_USERKEY_CTL, 0x}, {CS35L36_OTP_CTRL1, 0x2460}, @@ -245,7 +245,7 @@ struct reg_default cs35l36_reg[] = { {CS35L36_PAC_INT7_CTRL, 0x0001}, }; -bool cs35l36_readable_reg(struct device *dev, unsigned int reg) +static bool cs35l36_readable_reg(struct device *dev, unsigned int reg) { switch (reg) { case CS35L36_SW_RESET: @@ -395,7 +395,7 @@ bool cs35l36_readable_reg(struct device *dev, unsigned int reg) } } -bool cs35l36_precious_reg(struct device *dev, unsigned int reg) +static bool cs35l36_precious_reg(struct device *dev, unsigned int reg) { switch (reg) { case CS35L36_TESTKEY_CTRL: @@ -407,7 +407,7 @@ bool cs35l36_precious_reg(struct device *dev, unsigned int reg) } } -bool cs35l36_volatile_reg(struct device *dev, unsigned int reg) +static bool cs35l36_volatile_reg(struct device *dev, unsigned int reg) { switch (reg) { case CS35L36_SW_RESET:
[PATCH -next] platform/chrome: Make function wilco_ec_transfer() static
Fixes the following sparse warning: drivers/platform/chrome/wilco_ec/mailbox.c:126:5: warning: symbol 'wilco_ec_transfer' was not declared. Should it be static? Fixes: 436dad4fda10 ("platform/chrome: Add new driver for Wilco EC") Signed-off-by: Wei Yongjun --- drivers/platform/chrome/wilco_ec/mailbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c index c7028488e575..f6ff29a11f1a 100644 --- a/drivers/platform/chrome/wilco_ec/mailbox.c +++ b/drivers/platform/chrome/wilco_ec/mailbox.c @@ -123,8 +123,9 @@ static void wilco_ec_prepare(struct wilco_ec_message *msg, * Context: ec->mailbox_lock should be held while using this function. * Return: number of bytes received or negative error code on failure. */ -int wilco_ec_transfer(struct wilco_ec_device *ec, struct wilco_ec_message *msg, - struct wilco_ec_request *rq) +static int wilco_ec_transfer(struct wilco_ec_device *ec, +struct wilco_ec_message *msg, +struct wilco_ec_request *rq) { struct wilco_ec_response *rs; u8 checksum;
[PATCH -next] ASoC: wm8741: Make function 'wm8741_mute' static
Fixes the following sparse warning: sound/soc/codecs/wm8741.c:371:5: warning: symbol 'wm8741_mute' was not declared. Should it be static? Fixes: 36b1599340b5 ("ASoC: wm8741: Add digital mute callback") Signed-off-by: Wei Yongjun --- sound/soc/codecs/wm8741.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index a4b8c459ea57..546ea735f534 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -368,7 +368,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, return 0; } -int wm8741_mute(struct snd_soc_dai *codec_dai, int mute) +static int wm8741_mute(struct snd_soc_dai *codec_dai, int mute) { struct snd_soc_component *component = codec_dai->component;
[PATCH -next] misc: fastrpc: Fix return value check in fastrpc_map_create()
In case of error, the function dma_buf_get() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun --- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4b0db33896df..7edceaa6adaa 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -496,8 +496,8 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd, map->fl = fl; map->fd = fd; map->buf = dma_buf_get(fd); - if (!map->buf) { - err = -EINVAL; + if (IS_ERR(map->buf)) { + err = PTR_ERR(map->buf); goto get_err; }
[PATCH -next] ASoC: samsung: i2s: Fix return value check in i2s_create_secondary_device()
In case of error, the function platform_device_register_simple() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 7196c64c7d0c ("ASoC: samsung: i2s: Restore support for the secondary PCM") Signed-off-by: Wei Yongjun --- sound/soc/samsung/i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 72f0cb7abb30..15844c00c3cd 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1342,8 +1342,8 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) int ret; pdev = platform_device_register_simple("samsung-i2s-sec", -1, NULL, 0); - if (!pdev) - return -ENOMEM; + if (IS_ERR(pdev)) + return PTR_ERR(pdev); ret = device_attach(>dev); if (ret < 0) {
[PATCH -next] ASoC: mediatek: mt8183: make some functions static
Fixes the following sparse warnings: sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:966:5: warning: symbol 'mt8183_dai_i2s_get_share' was not declared. Should it be static? sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:986:5: warning: symbol 'mt8183_dai_i2s_set_priv' was not declared. Should it be static? Fixes: a94aec035a12 ("ASoC: mediatek: mt8183: add platform driver") Signed-off-by: Wei Yongjun --- sound/soc/mediatek/mt8183/mt8183-dai-i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c index c25024f72e72..777e93d70bea 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c @@ -963,7 +963,7 @@ static const struct mtk_afe_i2s_priv mt8183_i2s_priv[DAI_I2S_NUM] = { }, }; -int mt8183_dai_i2s_get_share(struct mtk_base_afe *afe) +static int mt8183_dai_i2s_get_share(struct mtk_base_afe *afe) { struct mt8183_afe_private *afe_priv = afe->platform_priv; const struct device_node *of_node = afe->dev->of_node; @@ -983,7 +983,7 @@ int mt8183_dai_i2s_get_share(struct mtk_base_afe *afe) return 0; } -int mt8183_dai_i2s_set_priv(struct mtk_base_afe *afe) +static int mt8183_dai_i2s_set_priv(struct mtk_base_afe *afe) { struct mt8183_afe_private *afe_priv = afe->platform_priv; struct mtk_afe_i2s_priv *i2s_priv;
[PATCH -next] ASoC: cros_ec_codec: Make symbol 'cros_ec_dai' static
Fixes the following sparse warning: sound/soc/codecs/cros_ec_codec.c:209:27: warning: symbol 'cros_ec_dai' was not declared. Should it be static? Fixes: b291f42a3718 ("ASoC: cros_ec_codec: Add codec driver for Cros EC") Signed-off-by: Wei Yongjun --- sound/soc/codecs/cros_ec_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index b14100b6a939..99a3af8a15ff 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -206,7 +206,7 @@ static const struct snd_soc_dai_ops cros_ec_i2s_dai_ops = { .set_fmt = cros_ec_i2s_set_dai_fmt, }; -struct snd_soc_dai_driver cros_ec_dai[] = { +static struct snd_soc_dai_driver cros_ec_dai[] = { { .name = "cros_ec_codec I2S", .id = 0,
[PATCH -next] extcon: ptn5150: Fix return value check in ptn5150_i2c_probe()
In case of error, the function devm_gpiod_get() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 58963276749e ("extcon: Add support for ptn5150 extcon driver") Signed-off-by: Wei Yongjun --- drivers/extcon/extcon-ptn5150.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c index 155620b..8217fdc 100644 --- a/drivers/extcon/extcon-ptn5150.c +++ b/drivers/extcon/extcon-ptn5150.c @@ -240,14 +240,14 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c, info->dev = >dev; info->i2c = i2c; info->int_gpiod = devm_gpiod_get(>dev, "int", GPIOD_IN); - if (!info->int_gpiod) { + if (IS_ERR(info->int_gpiod)) { dev_err(dev, "failed to get INT GPIO\n"); - return -EINVAL; + return PTR_ERR(info->int_gpiod); } info->vbus_gpiod = devm_gpiod_get(>dev, "vbus", GPIOD_IN); - if (!info->vbus_gpiod) { + if (IS_ERR(info->vbus_gpiod)) { dev_err(dev, "failed to get VBUS GPIO\n"); - return -EINVAL; + return PTR_ERR(info->vbus_gpiod); } ret = gpiod_direction_output(info->vbus_gpiod, 0); if (ret) {
[PATCH v4] binderfs: fix error return code in binderfs_fill_super()
Fix to return a negative error code -ENOMEM from the new_inode() and d_make_root() error handling cases instead of 0, as done elsewhere in this function. Fixes: 849d540ddfcd ("binderfs: implement "max" mount option") Signed-off-by: Wei Yongjun Reviewed-by: Christian Brauner --- v1 -> v2: move 'ret = -ENOMEM' out of if v2 -> v3: use correct fixes commit v3 -> v4: add reviewed-by --- drivers/android/binderfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 9518e2e..e4ff4c3 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_fs_info = info; + ret = -ENOMEM; inode = new_inode(sb); if (!inode) goto err_without_dentry;
[PATCH v3] binderfs: fix error return code in binderfs_fill_super()
Fix to return a negative error code -ENOMEM from the new_inode() and d_make_root() error handling cases instead of 0, as done elsewhere in this function. Fixes: 849d540ddfcd ("binderfs: implement "max" mount option") Signed-off-by: Wei Yongjun --- v1 -> v2: move 'ret = -ENOMEM' out of if v2 -> v3: use correct fixes commit --- drivers/android/binderfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 9518e2e..e4ff4c3 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_fs_info = info; + ret = -ENOMEM; inode = new_inode(sb); if (!inode) goto err_without_dentry;
[PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()
Fix to return a negative error code -ENOMEM from the new_inode() and d_make_root() error handling cases instead of 0, as done elsewhere in this function. Fixes: 3ad20fe393b3 ("binder: implement binderfs") Signed-off-by: Wei Yongjun --- v1 -> v2: move 'ret = -ENOMEM' out of if --- drivers/android/binderfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 9518e2e..e4ff4c3 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_fs_info = info; + ret = -ENOMEM; inode = new_inode(sb); if (!inode) goto err_without_dentry;
[PATCH -next] soc: bcm: bcm2835-pm: Make local symbol static
Fixes the following sparse warning: drivers/soc/bcm/bcm2835-power.c:556:32: warning: symbol 'bcm2835_reset_ops' was not declared. Should it be static? Fixes: 670c672608a1 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.") Signed-off-by: Wei Yongjun --- drivers/soc/bcm/bcm2835-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c index 4841295..9351349 100644 --- a/drivers/soc/bcm/bcm2835-power.c +++ b/drivers/soc/bcm/bcm2835-power.c @@ -553,7 +553,7 @@ static int bcm2835_reset_status(struct reset_controller_dev *rcdev, } } -const struct reset_control_ops bcm2835_reset_ops = { +static const struct reset_control_ops bcm2835_reset_ops = { .reset = bcm2835_reset_reset, .status = bcm2835_reset_status, };
[PATCH -next] binderfs: fix error return code in binderfs_fill_super()
Fix to return a negative error code -ENOMEM from the new_inode() and d_make_root() error handling cases instead of 0, as done elsewhere in this function. Fixes: 3ad20fe393b3 ("binder: implement binderfs") Signed-off-by: Wei Yongjun --- drivers/android/binderfs.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 9518e2e..2bf4b2b 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_fs_info = info; inode = new_inode(sb); - if (!inode) + if (!inode) { + ret = -ENOMEM; goto err_without_dentry; + } inode->i_ino = FIRST_INODE; inode->i_fop = _dir_operations; @@ -530,8 +532,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) set_nlink(inode, 2); sb->s_root = d_make_root(inode); - if (!sb->s_root) + if (!sb->s_root) { + ret = -ENOMEM; goto err_without_dentry; + } ret = binderfs_binder_ctl_create(sb); if (ret)
[PATCH -next v2] ASoC: Intel: bytcht_es8316: use correct drvdata in snd_byt_cht_es8316_mc_remove()
The snd_byt_cht_es8316_mc_remove() use the platform drvdata as a type of 'struct byt_cht_es8316_private', but snd_byt_cht_es8316_mc_probe() set it to 'struct snd_soc_card', as suggested by Dan Carpenter, fix the usage in snd_byt_cht_es8316_mc_remove(). Fixes: 0d3e91da0750 ("ASoC: Intel: bytcht_es8316: Add external speaker mux support") Signed-off-by: Wei Yongjun --- v1 -> v2: fix snd_byt_cht_es8316_mc_remove() instead, suggested by Dan. --- sound/soc/intel/boards/bytcht_es8316.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c index cdf2061..fa9c4cf 100644 --- a/sound/soc/intel/boards/bytcht_es8316.c +++ b/sound/soc/intel/boards/bytcht_es8316.c @@ -544,7 +544,8 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev) { - struct byt_cht_es8316_private *priv = platform_get_drvdata(pdev); + struct snd_soc_card *card = platform_get_drvdata(pdev); + struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card); gpiod_put(priv->speaker_en_gpio); return 0;
[PATCH -next] ASoC: Intel: bytcht_es8316: Set correct platform drvdata in snd_byt_cht_es8316_mc_probe()
The snd_byt_cht_es8316_mc_remove() use the platform drvdata as a type of 'struct byt_cht_es8316_private', but snd_byt_cht_es8316_mc_probe() set it to 'struct snd_soc_card', fix to pass correct platform drvdata to platform_set_drvdata(). Fixes: 0d3e91da0750 ("ASoC: Intel: bytcht_es8316: Add external speaker mux support") Signed-off-by: Wei Yongjun --- sound/soc/intel/boards/bytcht_es8316.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c index cdf2061..42111d8 100644 --- a/sound/soc/intel/boards/bytcht_es8316.c +++ b/sound/soc/intel/boards/bytcht_es8316.c @@ -538,7 +538,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) dev_err(dev, "snd_soc_register_card failed: %d\n", ret); return ret; } - platform_set_drvdata(pdev, _cht_es8316_card); + platform_set_drvdata(pdev, priv); return 0; }
[PATCH -next] regulator: act8945a-regulator: make symbol act8945a_pm static
Fixes the following sparse warning: drivers/regulator/act8945a-regulator.c:340:1: warning: symbol 'act8945a_pm' was not declared. Should it be static? Fixes: 7482d6ecc68e ("regulator: act8945a-regulator: Implement PM functionalities") Signed-off-by: Wei Yongjun --- drivers/regulator/act8945a-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c index 90572b6..dc3942b 100644 --- a/drivers/regulator/act8945a-regulator.c +++ b/drivers/regulator/act8945a-regulator.c @@ -337,7 +337,7 @@ static int act8945a_suspend(struct device *pdev) return regmap_write(act8945a->regmap, ACT8945A_SYS_CTRL, 0x42); } -SIMPLE_DEV_PM_OPS(act8945a_pm, act8945a_suspend, NULL); +static SIMPLE_DEV_PM_OPS(act8945a_pm, act8945a_suspend, NULL); static void act8945a_pmic_shutdown(struct platform_device *pdev) {
[PATCH -next] irqchip: irq-rda-intc: Fix return value check in rda8810_intc_init()
In case of error, the function of_io_request_and_map() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: d852e62ad689 ("irqchip: Add RDA8810PL interrupt driver") Signed-off-by: Wei Yongjun --- drivers/irqchip/irq-rda-intc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-rda-intc.c b/drivers/irqchip/irq-rda-intc.c index 1176291..9601683 100644 --- a/drivers/irqchip/irq-rda-intc.c +++ b/drivers/irqchip/irq-rda-intc.c @@ -85,8 +85,8 @@ static int __init rda8810_intc_init(struct device_node *node, struct device_node *parent) { rda_intc_base = of_io_request_and_map(node, 0, "rda-intc"); - if (!rda_intc_base) - return -ENXIO; + if (IS_ERR(rda_intc_base)) + return PTR_ERR(rda_intc_base); /* Mask all interrupt sources */ writel_relaxed(RDA_IRQ_MASK_ALL, rda_intc_base + RDA_INTC_MASK_CLR);
[PATCH] ASoC: stm32: sai: fix invalid use of sizeof in stm32_sai_add_mclk_provider()
sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data. Fixes: 8307b2afd386 ("ASoC: stm32: sai: set sai as mclk clock provider") Signed-off-by: Wei Yongjun --- sound/soc/stm/stm32_sai_sub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index ea05cc9..211589b 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -390,7 +390,7 @@ static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai) char *mclk_name, *p, *s = (char *)pname; int ret, i = 0; - mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL); + mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL); if (!mclk) return -ENOMEM;
[PATCH] ASoC: stm32: sai: fix invalid use of sizeof in stm32_sai_add_mclk_provider()
sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data. Fixes: 8307b2afd386 ("ASoC: stm32: sai: set sai as mclk clock provider") Signed-off-by: Wei Yongjun --- sound/soc/stm/stm32_sai_sub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index ea05cc9..211589b 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -390,7 +390,7 @@ static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai) char *mclk_name, *p, *s = (char *)pname; int ret, i = 0; - mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL); + mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL); if (!mclk) return -ENOMEM;
[PATCH -next] uio: make symbol 'uio_class_registered' static
Fixes the following sparse warning: drivers/uio/uio.c:277:6: warning: symbol 'uio_class_registered' was not declared. Should it be static? Fixes: ae61cf5b9913 ("uio: ensure class is registered before devices") Signed-off-by: Wei Yongjun --- drivers/uio/uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 0ffb324..d4cc07d 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -274,7 +274,7 @@ static ssize_t event_show(struct device *dev, .dev_groups = uio_groups, }; -bool uio_class_registered; +static bool uio_class_registered; /* * device functions
[PATCH -next] uio: make symbol 'uio_class_registered' static
Fixes the following sparse warning: drivers/uio/uio.c:277:6: warning: symbol 'uio_class_registered' was not declared. Should it be static? Fixes: ae61cf5b9913 ("uio: ensure class is registered before devices") Signed-off-by: Wei Yongjun --- drivers/uio/uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 0ffb324..d4cc07d 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -274,7 +274,7 @@ static ssize_t event_show(struct device *dev, .dev_groups = uio_groups, }; -bool uio_class_registered; +static bool uio_class_registered; /* * device functions
[PATCH -next] ANDROID: binder: make symbol 'binder_free_buf' static
Fixes the following sparse warning: drivers/android/binder.c:3312:1: warning: symbol 'binder_free_buf' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 1b54bb5..cb30a52 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3308,7 +3308,7 @@ static void binder_transaction(struct binder_proc *proc, * * Cleanup buffer and free it. */ -void +static void binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) { if (buffer->transaction) {
[PATCH -next] ANDROID: binder: make symbol 'binder_free_buf' static
Fixes the following sparse warning: drivers/android/binder.c:3312:1: warning: symbol 'binder_free_buf' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 1b54bb5..cb30a52 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3308,7 +3308,7 @@ static void binder_transaction(struct binder_proc *proc, * * Cleanup buffer and free it. */ -void +static void binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) { if (buffer->transaction) {
[PATCH -next] platform: goldfish: pipe: Make symbol 'goldfish_pipe_dev' static
Fixes the following sparse warning: drivers/platform/goldfish/goldfish_pipe.c:214:26: warning: symbol 'goldfish_pipe_dev' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/platform/goldfish/goldfish_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index b4a484b..0f66d77 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -211,7 +211,7 @@ struct goldfish_pipe_dev { unsigned char __iomem *base; }; -struct goldfish_pipe_dev goldfish_pipe_dev; +static struct goldfish_pipe_dev goldfish_pipe_dev; static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd)
[PATCH -next] platform: goldfish: pipe: Make symbol 'goldfish_pipe_dev' static
Fixes the following sparse warning: drivers/platform/goldfish/goldfish_pipe.c:214:26: warning: symbol 'goldfish_pipe_dev' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/platform/goldfish/goldfish_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index b4a484b..0f66d77 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -211,7 +211,7 @@ struct goldfish_pipe_dev { unsigned char __iomem *base; }; -struct goldfish_pipe_dev goldfish_pipe_dev; +static struct goldfish_pipe_dev goldfish_pipe_dev; static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd)
[PATCH -next] drm/vkms: Fix possible memory leak in _vkms_get_crc()
'vaddr_out' is malloced in _vkms_get_crc() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: db7f419c06d7 ("drm/vkms: Compute CRC with Cursor Plane") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vkms/vkms_crc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 0a27456..9d9e814 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -125,6 +125,7 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc, mutex_lock(_obj->pages_lock); if (WARN_ON(!vkms_obj->vaddr)) { mutex_unlock(_obj->pages_lock); + kfree(vaddr_out); return crc; }
[PATCH -next] drm/vkms: Fix possible memory leak in _vkms_get_crc()
'vaddr_out' is malloced in _vkms_get_crc() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: db7f419c06d7 ("drm/vkms: Compute CRC with Cursor Plane") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vkms/vkms_crc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 0a27456..9d9e814 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -125,6 +125,7 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc, mutex_lock(_obj->pages_lock); if (WARN_ON(!vkms_obj->vaddr)) { mutex_unlock(_obj->pages_lock); + kfree(vaddr_out); return crc; }
[PATCH -next] drm/vkms: Fix the error handling in vkms_init()
In the drm_vblank_init() error handling case, platform device unregister is missing. This patch fix it. Fixes: 3a0709928b17 ("drm/vkms: Add vblank events simulated by hrtimers") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6e728b8..5ad09d4 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -110,7 +110,7 @@ static int __init vkms_init(void) ret = drm_vblank_init(_device->drm, 1); if (ret) { DRM_ERROR("Failed to vblank\n"); - goto out_fini; + goto out_unregister; } ret = vkms_modeset_init(vkms_device);
[PATCH -next] drm/vkms: Fix the error handling in vkms_init()
In the drm_vblank_init() error handling case, platform device unregister is missing. This patch fix it. Fixes: 3a0709928b17 ("drm/vkms: Add vblank events simulated by hrtimers") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6e728b8..5ad09d4 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -110,7 +110,7 @@ static int __init vkms_init(void) ret = drm_vblank_init(_device->drm, 1); if (ret) { DRM_ERROR("Failed to vblank\n"); - goto out_fini; + goto out_unregister; } ret = vkms_modeset_init(vkms_device);
[PATCH -next] ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data. Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing") Signed-off-by: Wei Yongjun --- sound/usb/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 8fe3b0e..67cf849 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1037,7 +1037,7 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, fp->rate_max = UAC3_BADD_SAMPLING_RATE; fp->rates = SNDRV_PCM_RATE_CONTINUOUS; - pd = kzalloc(sizeof(pd), GFP_KERNEL); + pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) { kfree(fp->rate_table); kfree(fp);
[PATCH -next] ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data. Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing") Signed-off-by: Wei Yongjun --- sound/usb/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 8fe3b0e..67cf849 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1037,7 +1037,7 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, fp->rate_max = UAC3_BADD_SAMPLING_RATE; fp->rates = SNDRV_PCM_RATE_CONTINUOUS; - pd = kzalloc(sizeof(pd), GFP_KERNEL); + pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) { kfree(fp->rate_table); kfree(fp);
[PATCH -next] staging: axis-fifo: fix return value check in axis_fifo_probe()
In case of error, the function device_create() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 4a965c5f89de ("staging: add driver for Xilinx AXI-Stream FIFO v4.1 IP core") Signed-off-by: Wei Yongjun --- drivers/staging/axis-fifo/axis-fifo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 2a73302..51a081d 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -1006,10 +1006,10 @@ static int axis_fifo_probe(struct platform_device *pdev) /* create driver file */ fifo->device = device_create(axis_fifo_driver_class, NULL, fifo->devt, NULL, device_name); - if (!fifo->device) { + if (IS_ERR(fifo->device)) { dev_err(fifo->dt_device, "couldn't create driver file\n"); - rc = -ENOMEM; + rc = PTR_ERR(fifo->device); goto err_chrdev_region; } dev_set_drvdata(fifo->device, fifo);
[PATCH -next] staging: axis-fifo: fix return value check in axis_fifo_probe()
In case of error, the function device_create() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 4a965c5f89de ("staging: add driver for Xilinx AXI-Stream FIFO v4.1 IP core") Signed-off-by: Wei Yongjun --- drivers/staging/axis-fifo/axis-fifo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 2a73302..51a081d 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -1006,10 +1006,10 @@ static int axis_fifo_probe(struct platform_device *pdev) /* create driver file */ fifo->device = device_create(axis_fifo_driver_class, NULL, fifo->devt, NULL, device_name); - if (!fifo->device) { + if (IS_ERR(fifo->device)) { dev_err(fifo->dt_device, "couldn't create driver file\n"); - rc = -ENOMEM; + rc = PTR_ERR(fifo->device); goto err_chrdev_region; } dev_set_drvdata(fifo->device, fifo);
[PATCH -next] fsi: sbefifo: Fix missing unlock on error in sbefifo_dump_ffdc()
Add the missing unlock before return from function sbefifo_dump_ffdc() in the error handling case. Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO") Signed-off-by: Wei Yongjun --- drivers/fsi/fsi-sbefifo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 6b31cc24..35f2749 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -150,6 +150,7 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, u32 w0, w1, w2, i; if (ffdc_sz < 3) { dev_err(dev, "SBE invalid FFDC package size %zd\n", ffdc_sz); + mutex_unlock(_ffdc_mutex); return; } w0 = be32_to_cpu(*(ffdc++));
[PATCH -next] fsi: sbefifo: Fix missing unlock on error in sbefifo_dump_ffdc()
Add the missing unlock before return from function sbefifo_dump_ffdc() in the error handling case. Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO") Signed-off-by: Wei Yongjun --- drivers/fsi/fsi-sbefifo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 6b31cc24..35f2749 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -150,6 +150,7 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, u32 w0, w1, w2, i; if (ffdc_sz < 3) { dev_err(dev, "SBE invalid FFDC package size %zd\n", ffdc_sz); + mutex_unlock(_ffdc_mutex); return; } w0 = be32_to_cpu(*(ffdc++));
[PATCH -next] misc: vexpress: Fix potential NULL dereference in vexpress_syscfg_probe()
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code. This is detected by Coccinelle semantic patch. @@ expression pdev, res, n, t, e, e1, e2; @@ res = platform_get_resource(pdev, t, n); + if (!res) + return -EINVAL; ... when != res == NULL e = devm_ioremap(e1, res->start, e2); Signed-off-by: Wei Yongjun --- drivers/misc/vexpress-syscfg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c index 9eea30f..2d72c93 100644 --- a/drivers/misc/vexpress-syscfg.c +++ b/drivers/misc/vexpress-syscfg.c @@ -259,6 +259,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) INIT_LIST_HEAD(>funcs); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; if (!devm_request_mem_region(>dev, res->start, resource_size(res), pdev->name)) return -EBUSY;
[PATCH -next] misc: vexpress: Fix potential NULL dereference in vexpress_syscfg_probe()
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code. This is detected by Coccinelle semantic patch. @@ expression pdev, res, n, t, e, e1, e2; @@ res = platform_get_resource(pdev, t, n); + if (!res) + return -EINVAL; ... when != res == NULL e = devm_ioremap(e1, res->start, e2); Signed-off-by: Wei Yongjun --- drivers/misc/vexpress-syscfg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c index 9eea30f..2d72c93 100644 --- a/drivers/misc/vexpress-syscfg.c +++ b/drivers/misc/vexpress-syscfg.c @@ -259,6 +259,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) INIT_LIST_HEAD(>funcs); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; if (!devm_request_mem_region(>dev, res->start, resource_size(res), pdev->name)) return -EBUSY;
[PATCH -next] staging: pi433: fix error return code in pi433_probe()
Fix to return a negative error code from the kthread_run() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/staging/pi433/pi433_if.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 293602d..d4bfac1 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1235,6 +1235,7 @@ static int pi433_probe(struct spi_device *spi) device->minor); if (IS_ERR(device->tx_task_struct)) { dev_dbg(device->dev, "start of send thread failed"); + retval = PTR_ERR(device->tx_task_struct); goto send_thread_failed; }
[PATCH -next] staging: pi433: fix error return code in pi433_probe()
Fix to return a negative error code from the kthread_run() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/staging/pi433/pi433_if.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 293602d..d4bfac1 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1235,6 +1235,7 @@ static int pi433_probe(struct spi_device *spi) device->minor); if (IS_ERR(device->tx_task_struct)) { dev_dbg(device->dev, "start of send thread failed"); + retval = PTR_ERR(device->tx_task_struct); goto send_thread_failed; }
[PATCH -next v3] mtd: spinand: fix missing unlock on error
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- v2 -> v3: remove blank line v1 -> v2: using break instead of return --- drivers/mtd/nand/spi/core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..8998dca 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -561,11 +561,11 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +609,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next v3] mtd: spinand: fix missing unlock on error
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- v2 -> v3: remove blank line v1 -> v2: using break instead of return --- drivers/mtd/nand/spi/core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..8998dca 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -561,11 +561,11 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +609,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next v2] mtd: spinand: fix missing unlock on error
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- v1 -> v2: using break instead of return --- drivers/mtd/nand/spi/core.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..e072464 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -561,11 +561,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; + ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +610,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next v2] mtd: spinand: fix missing unlock on error
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- v1 -> v2: using break instead of return --- drivers/mtd/nand/spi/core.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..e072464 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -561,11 +561,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; + ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +610,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next] mtd: spinand: Fix error return code in spinand_init()
Fix to return error code -ENOMEM from the kzalloc() error handling case instead of 0, as done elsewhere in this function. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- drivers/mtd/nand/spi/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..011683e 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -985,8 +985,10 @@ static int spinand_init(struct spinand_device *spinand) spinand->databuf = kzalloc(nanddev_page_size(nand) + nanddev_per_page_oobsize(nand), GFP_KERNEL); - if (!spinand->databuf) + if (!spinand->databuf) { + ret = -ENOMEM; goto err_free_bufs; + } spinand->oobbuf = spinand->databuf + nanddev_page_size(nand);
[PATCH -next] mtd: spinand: Fix error return code in spinand_init()
Fix to return error code -ENOMEM from the kzalloc() error handling case instead of 0, as done elsewhere in this function. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- drivers/mtd/nand/spi/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..011683e 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -985,8 +985,10 @@ static int spinand_init(struct spinand_device *spinand) spinand->databuf = kzalloc(nanddev_page_size(nand) + nanddev_per_page_oobsize(nand), GFP_KERNEL); - if (!spinand->databuf) + if (!spinand->databuf) { + ret = -ENOMEM; goto err_free_bufs; + } spinand->oobbuf = spinand->databuf + nanddev_page_size(nand);
[PATCH -next] mtd: spinand: Fix missing unlock on error path
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- drivers/mtd/nand/spi/core.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..8ac1ba95 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -560,12 +560,16 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); - if (ret) + if (ret) { + mutex_unlock(>lock); return ret; + } ret = spinand_ecc_enable(spinand, enable_ecc); - if (ret) + if (ret) { + mutex_unlock(>lock); return ret; + } ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +613,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next] mtd: spinand: Fix missing unlock on error path
Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- drivers/mtd/nand/spi/core.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..8ac1ba95 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -560,12 +560,16 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); - if (ret) + if (ret) { + mutex_unlock(>lock); return ret; + } ret = spinand_ecc_enable(spinand, enable_ecc); - if (ret) + if (ret) { + mutex_unlock(>lock); return ret; + } ret = spinand_read_page(spinand, , enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +613,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, ) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, ); if (ret)
[PATCH -next] ASoC: rt5682: use devm_snd_soc_register_component()
Using devm_snd_soc_register_component() and drop all of the code related to .remove hook. Signed-off-by: Wei Yongjun --- sound/soc/codecs/rt5682.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index 61a9730..baad177 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2630,17 +2630,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, } - return snd_soc_register_component(>dev, _component_dev_rt5682, + return devm_snd_soc_register_component(>dev, + _component_dev_rt5682, rt5682_dai, ARRAY_SIZE(rt5682_dai)); } -static int rt5682_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_component(>dev); - - return 0; -} - static void rt5682_i2c_shutdown(struct i2c_client *client) { struct rt5682_priv *rt5682 = i2c_get_clientdata(client); @@ -2671,7 +2665,6 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) .acpi_match_table = ACPI_PTR(rt5682_acpi_match), }, .probe = rt5682_i2c_probe, - .remove = rt5682_i2c_remove, .shutdown = rt5682_i2c_shutdown, .id_table = rt5682_i2c_id, };
[PATCH -next] ASoC: rt5682: use devm_snd_soc_register_component()
Using devm_snd_soc_register_component() and drop all of the code related to .remove hook. Signed-off-by: Wei Yongjun --- sound/soc/codecs/rt5682.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index 61a9730..baad177 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2630,17 +2630,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, } - return snd_soc_register_component(>dev, _component_dev_rt5682, + return devm_snd_soc_register_component(>dev, + _component_dev_rt5682, rt5682_dai, ARRAY_SIZE(rt5682_dai)); } -static int rt5682_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_component(>dev); - - return 0; -} - static void rt5682_i2c_shutdown(struct i2c_client *client) { struct rt5682_priv *rt5682 = i2c_get_clientdata(client); @@ -2671,7 +2665,6 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) .acpi_match_table = ACPI_PTR(rt5682_acpi_match), }, .probe = rt5682_i2c_probe, - .remove = rt5682_i2c_remove, .shutdown = rt5682_i2c_shutdown, .id_table = rt5682_i2c_id, };
[PATCH -next] ASoC: rt1305: use devm_snd_soc_register_component()
Using devm_snd_soc_register_component() and drop all of the code related to .remove hook. Signed-off-by: Wei Yongjun --- sound/soc/codecs/rt1305.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/rt1305.c b/sound/soc/codecs/rt1305.c index 421b8fb..c4452ef 100644 --- a/sound/soc/codecs/rt1305.c +++ b/sound/soc/codecs/rt1305.c @@ -1150,17 +1150,11 @@ static int rt1305_i2c_probe(struct i2c_client *i2c, rt1305_reset(rt1305->regmap); rt1305_calibrate(rt1305); - return snd_soc_register_component(>dev, _component_dev_rt1305, + return devm_snd_soc_register_component(>dev, + _component_dev_rt1305, rt1305_dai, ARRAY_SIZE(rt1305_dai)); } -static int rt1305_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_component(>dev); - - return 0; -} - static void rt1305_i2c_shutdown(struct i2c_client *client) { struct rt1305_priv *rt1305 = i2c_get_clientdata(client); @@ -1180,7 +1174,6 @@ static void rt1305_i2c_shutdown(struct i2c_client *client) #endif }, .probe = rt1305_i2c_probe, - .remove = rt1305_i2c_remove, .shutdown = rt1305_i2c_shutdown, .id_table = rt1305_i2c_id, };
[PATCH -next] ASoC: rt1305: use devm_snd_soc_register_component()
Using devm_snd_soc_register_component() and drop all of the code related to .remove hook. Signed-off-by: Wei Yongjun --- sound/soc/codecs/rt1305.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/rt1305.c b/sound/soc/codecs/rt1305.c index 421b8fb..c4452ef 100644 --- a/sound/soc/codecs/rt1305.c +++ b/sound/soc/codecs/rt1305.c @@ -1150,17 +1150,11 @@ static int rt1305_i2c_probe(struct i2c_client *i2c, rt1305_reset(rt1305->regmap); rt1305_calibrate(rt1305); - return snd_soc_register_component(>dev, _component_dev_rt1305, + return devm_snd_soc_register_component(>dev, + _component_dev_rt1305, rt1305_dai, ARRAY_SIZE(rt1305_dai)); } -static int rt1305_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_component(>dev); - - return 0; -} - static void rt1305_i2c_shutdown(struct i2c_client *client) { struct rt1305_priv *rt1305 = i2c_get_clientdata(client); @@ -1180,7 +1174,6 @@ static void rt1305_i2c_shutdown(struct i2c_client *client) #endif }, .probe = rt1305_i2c_probe, - .remove = rt1305_i2c_remove, .shutdown = rt1305_i2c_shutdown, .id_table = rt1305_i2c_id, };
[PATCH -next] mqueue: fix a typo in mq_init_ns()
Fix a typo, use 'm' instead of 'ns->mq_mnt'. Fixes: 5cd6a50ace05 ("ipc: Convert mqueue fs to fs_context") Signed-off-by: Wei Yongjun --- ipc/mqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 833b8d7..0f10221 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1620,7 +1620,7 @@ int mq_init_ns(struct ipc_namespace *ns) m = mq_create_mount(_ipc_ns); if (IS_ERR(m)) - return PTR_ERR(ns->mq_mnt); + return PTR_ERR(m); ns->mq_mnt = m; return 0; }
[PATCH -next] mqueue: fix a typo in mq_init_ns()
Fix a typo, use 'm' instead of 'ns->mq_mnt'. Fixes: 5cd6a50ace05 ("ipc: Convert mqueue fs to fs_context") Signed-off-by: Wei Yongjun --- ipc/mqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 833b8d7..0f10221 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1620,7 +1620,7 @@ int mq_init_ns(struct ipc_namespace *ns) m = mq_create_mount(_ipc_ns); if (IS_ERR(m)) - return PTR_ERR(ns->mq_mnt); + return PTR_ERR(m); ns->mq_mnt = m; return 0; }
[PATCH -next] nvmet: fix error return code in nvmet_file_ns_enable()
Fix to return error code -ENOMEM from the memory alloc fail error handling case instead of 0, as done elsewhere in this function. Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support") Signed-off-by: Wei Yongjun --- drivers/nvme/target/io-cmd-file.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index ca1ccf8..e9d6ce4 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -49,14 +49,18 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) ns->bvec_cache = kmem_cache_create("nvmet-bvec", NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec), 0, SLAB_HWCACHE_ALIGN, NULL); - if (!ns->bvec_cache) + if (!ns->bvec_cache) { + ret = -ENOMEM; goto err; + } ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab, mempool_free_slab, ns->bvec_cache); - if (!ns->bvec_pool) + if (!ns->bvec_pool) { + ret = -ENOMEM; goto err; + } return ret; err:
[PATCH -next] nvmet: fix error return code in nvmet_file_ns_enable()
Fix to return error code -ENOMEM from the memory alloc fail error handling case instead of 0, as done elsewhere in this function. Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support") Signed-off-by: Wei Yongjun --- drivers/nvme/target/io-cmd-file.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index ca1ccf8..e9d6ce4 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -49,14 +49,18 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) ns->bvec_cache = kmem_cache_create("nvmet-bvec", NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec), 0, SLAB_HWCACHE_ALIGN, NULL); - if (!ns->bvec_cache) + if (!ns->bvec_cache) { + ret = -ENOMEM; goto err; + } ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab, mempool_free_slab, ns->bvec_cache); - if (!ns->bvec_pool) + if (!ns->bvec_pool) { + ret = -ENOMEM; goto err; + } return ret; err:
[PATCH -next] nvmet: fix a typo in nvmet_file_ns_enable()
Fix a typo in nvmet_file_ns_enable(). Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support") Signed-off-by: Wei Yongjun --- drivers/nvme/target/io-cmd-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index ca1ccf8..9cff553 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -34,7 +34,7 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) O_RDWR | O_LARGEFILE | O_DIRECT, 0); if (IS_ERR(ns->file)) { pr_err("failed to open file %s: (%ld)\n", - ns->device_path, PTR_ERR(ns->bdev)); + ns->device_path, PTR_ERR(ns->file)); return PTR_ERR(ns->file); }
[PATCH -next] nvmet: fix a typo in nvmet_file_ns_enable()
Fix a typo in nvmet_file_ns_enable(). Fixes: d5eff33ee6f8 ("nvmet: add simple file backed ns support") Signed-off-by: Wei Yongjun --- drivers/nvme/target/io-cmd-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index ca1ccf8..9cff553 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -34,7 +34,7 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) O_RDWR | O_LARGEFILE | O_DIRECT, 0); if (IS_ERR(ns->file)) { pr_err("failed to open file %s: (%ld)\n", - ns->device_path, PTR_ERR(ns->bdev)); + ns->device_path, PTR_ERR(ns->file)); return PTR_ERR(ns->file); }
[PATCH -next] misc: ibmvmc: Use GFP_ATOMIC under spin lock
The function alloc_dma_buffer() is called from ibmvmc_add_buffer(), in which a spin lock be held here, so we should use GFP_ATOMIC when a lock is held. Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/misc/ibmvmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c index fb83d13..8f82bb9 100644 --- a/drivers/misc/ibmvmc.c +++ b/drivers/misc/ibmvmc.c @@ -273,7 +273,7 @@ static void *alloc_dma_buffer(struct vio_dev *vdev, size_t size, dma_addr_t *dma_handle) { /* allocate memory */ - void *buffer = kzalloc(size, GFP_KERNEL); + void *buffer = kzalloc(size, GFP_ATOMIC); if (!buffer) { *dma_handle = 0;
[PATCH -next] misc: ibmvmc: Use GFP_ATOMIC under spin lock
The function alloc_dma_buffer() is called from ibmvmc_add_buffer(), in which a spin lock be held here, so we should use GFP_ATOMIC when a lock is held. Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)") Signed-off-by: Wei Yongjun --- drivers/misc/ibmvmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c index fb83d13..8f82bb9 100644 --- a/drivers/misc/ibmvmc.c +++ b/drivers/misc/ibmvmc.c @@ -273,7 +273,7 @@ static void *alloc_dma_buffer(struct vio_dev *vdev, size_t size, dma_addr_t *dma_handle) { /* allocate memory */ - void *buffer = kzalloc(size, GFP_KERNEL); + void *buffer = kzalloc(size, GFP_ATOMIC); if (!buffer) { *dma_handle = 0;
[PATCH -next] slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code. This is detected by Coccinelle semantic patch. @@ expression pdev, res, n, t, e, e1, e2; @@ res = platform_get_resource_byname(pdev, t, n); + if (!res) + return -EINVAL; ... when != res == NULL e = devm_ioremap(e1, res->start, e2); Fixes: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/slimbus/qcom-ctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index bb36a8f..caea3b9 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -478,6 +478,8 @@ static void qcom_slim_prg_slew(struct platform_device *pdev, /* SLEW RATE register for this SLIMbus */ slew_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slew"); + if (!slew_mem) + return; ctrl->slew_reg = devm_ioremap(>dev, slew_mem->start, resource_size(slew_mem)); if (!ctrl->slew_reg)
[PATCH -next] slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code. This is detected by Coccinelle semantic patch. @@ expression pdev, res, n, t, e, e1, e2; @@ res = platform_get_resource_byname(pdev, t, n); + if (!res) + return -EINVAL; ... when != res == NULL e = devm_ioremap(e1, res->start, e2); Fixes: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver") Signed-off-by: Wei Yongjun --- drivers/slimbus/qcom-ctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index bb36a8f..caea3b9 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -478,6 +478,8 @@ static void qcom_slim_prg_slew(struct platform_device *pdev, /* SLEW RATE register for this SLIMbus */ slew_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slew"); + if (!slew_mem) + return; ctrl->slew_reg = devm_ioremap(>dev, slew_mem->start, resource_size(slew_mem)); if (!ctrl->slew_reg)
[tip:efi/core] efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static
Commit-ID: 0add16c13f49bda5455d9418d479d6c89f7ab272 Gitweb: https://git.kernel.org/tip/0add16c13f49bda5455d9418d479d6c89f7ab272 Author: Wei Yongjun <weiyongj...@huawei.com> AuthorDate: Fri, 4 May 2018 07:59:57 +0200 Committer: Ingo Molnar <mi...@kernel.org> CommitDate: Mon, 14 May 2018 08:57:48 +0200 efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static Fixes the following sparse warning: drivers/firmware/efi/libstub/tpm.c:62:6: warning: symbol 'efi_retrieve_tpm2_eventlog_1_2' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> Reviewed-by: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Matt Fleming <m...@codeblueprint.co.uk> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Thomas Gleixner <t...@linutronix.de> Cc: linux-...@vger.kernel.org Link: http://lkml.kernel.org/r/20180504060003.19618-12-ard.biesheu...@linaro.org Signed-off-by: Ingo Molnar <mi...@kernel.org> --- drivers/firmware/efi/libstub/tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index 9d08cea3f1b0..caa37a6dd9d4 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -59,7 +59,7 @@ void efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) #endif -void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) +static void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) { efi_guid_t tcg2_guid = EFI_TCG2_PROTOCOL_GUID; efi_guid_t linux_eventlog_guid = LINUX_EFI_TPM_EVENT_LOG_GUID;
[tip:efi/core] efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static
Commit-ID: 0add16c13f49bda5455d9418d479d6c89f7ab272 Gitweb: https://git.kernel.org/tip/0add16c13f49bda5455d9418d479d6c89f7ab272 Author: Wei Yongjun AuthorDate: Fri, 4 May 2018 07:59:57 +0200 Committer: Ingo Molnar CommitDate: Mon, 14 May 2018 08:57:48 +0200 efi/libstub/tpm: Make function efi_retrieve_tpm2_eventlog_1_2() static Fixes the following sparse warning: drivers/firmware/efi/libstub/tpm.c:62:6: warning: symbol 'efi_retrieve_tpm2_eventlog_1_2' was not declared. Should it be static? Signed-off-by: Wei Yongjun Signed-off-by: Ard Biesheuvel Reviewed-by: Jarkko Sakkinen Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-...@vger.kernel.org Link: http://lkml.kernel.org/r/20180504060003.19618-12-ard.biesheu...@linaro.org Signed-off-by: Ingo Molnar --- drivers/firmware/efi/libstub/tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index 9d08cea3f1b0..caa37a6dd9d4 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -59,7 +59,7 @@ void efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) #endif -void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) +static void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) { efi_guid_t tcg2_guid = EFI_TCG2_PROTOCOL_GUID; efi_guid_t linux_eventlog_guid = LINUX_EFI_TPM_EVENT_LOG_GUID;
[PATCH -next] ASoC: fix return value check in mt6351_codec_driver_probe()
In case of error, the function dev_get_regmap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- sound/soc/codecs/mt6351.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6351.c b/sound/soc/codecs/mt6351.c index e739f07..f73dcd7 100644 --- a/sound/soc/codecs/mt6351.c +++ b/sound/soc/codecs/mt6351.c @@ -1472,8 +1472,8 @@ static int mt6351_codec_driver_probe(struct platform_device *pdev) priv->dev = >dev; priv->regmap = dev_get_regmap(pdev->dev.parent, NULL); - if (IS_ERR(priv->regmap)) - return PTR_ERR(priv->regmap); + if (!priv->regmap) + return -ENODEV; dev_dbg(priv->dev, "%s(), dev name %s\n", __func__, dev_name(>dev));
[PATCH -next] ASoC: fix return value check in mt6351_codec_driver_probe()
In case of error, the function dev_get_regmap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun --- sound/soc/codecs/mt6351.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6351.c b/sound/soc/codecs/mt6351.c index e739f07..f73dcd7 100644 --- a/sound/soc/codecs/mt6351.c +++ b/sound/soc/codecs/mt6351.c @@ -1472,8 +1472,8 @@ static int mt6351_codec_driver_probe(struct platform_device *pdev) priv->dev = >dev; priv->regmap = dev_get_regmap(pdev->dev.parent, NULL); - if (IS_ERR(priv->regmap)) - return PTR_ERR(priv->regmap); + if (!priv->regmap) + return -ENODEV; dev_dbg(priv->dev, "%s(), dev name %s\n", __func__, dev_name(>dev));
[PATCH -next] m68k: fix return value check in mcf_pci_init()
In case of error, the function ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: bf114d773167 ("m68k: force use of __raw_read/__raw_write address to be iomem") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- arch/m68k/coldfire/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index 9d6342c..a7c2332 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -218,7 +218,7 @@ static int __init mcf_pci_init(void) /* Keep a virtual mapping to IO/config space active */ iospace = ioremap(PCI_IO_PA, PCI_IO_SIZE); - if (IS_ERR(iospace)) + if (!iospace) return -ENODEV; pr_info("Coldfire: PCI IO/config window mapped to 0x%p\n", iospace);
[PATCH -next] m68k: fix return value check in mcf_pci_init()
In case of error, the function ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: bf114d773167 ("m68k: force use of __raw_read/__raw_write address to be iomem") Signed-off-by: Wei Yongjun --- arch/m68k/coldfire/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index 9d6342c..a7c2332 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -218,7 +218,7 @@ static int __init mcf_pci_init(void) /* Keep a virtual mapping to IO/config space active */ iospace = ioremap(PCI_IO_PA, PCI_IO_SIZE); - if (IS_ERR(iospace)) + if (!iospace) return -ENODEV; pr_info("Coldfire: PCI IO/config window mapped to 0x%p\n", iospace);
[PATCH -next] drm/amdkfd: Make function kfd_dev_is_large_bar() static
Fixes the following sparse warning: drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:1150:6: warning: symbol 'kfd_dev_is_large_bar' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index cd679cf..fb5d997 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1147,7 +1147,7 @@ static int kfd_ioctl_acquire_vm(struct file *filep, struct kfd_process *p, return ret; } -bool kfd_dev_is_large_bar(struct kfd_dev *dev) +static bool kfd_dev_is_large_bar(struct kfd_dev *dev) { struct kfd_local_mem_info mem_info;
[PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
Passing NULL pointer to PTR_ERR will result in return value of 0 indicating success which is clearly not what it is intended here. This patch returns -EINVAL instead. Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index cd679cf..c32a341 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, pdd = kfd_get_process_device_data(dev, p); if (!pdd) { - err = PTR_ERR(pdd); + err = -EINVAL; goto bind_process_to_device_failed; }
[PATCH -next] drm/amdkfd: Make function kfd_dev_is_large_bar() static
Fixes the following sparse warning: drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:1150:6: warning: symbol 'kfd_dev_is_large_bar' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index cd679cf..fb5d997 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1147,7 +1147,7 @@ static int kfd_ioctl_acquire_vm(struct file *filep, struct kfd_process *p, return ret; } -bool kfd_dev_is_large_bar(struct kfd_dev *dev) +static bool kfd_dev_is_large_bar(struct kfd_dev *dev) { struct kfd_local_mem_info mem_info;
[PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
Passing NULL pointer to PTR_ERR will result in return value of 0 indicating success which is clearly not what it is intended here. This patch returns -EINVAL instead. Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index cd679cf..c32a341 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, pdd = kfd_get_process_device_data(dev, p); if (!pdd) { - err = PTR_ERR(pdd); + err = -EINVAL; goto bind_process_to_device_failed; }
[PATCH -next] ASoC: amd: acp-da7219-max98357: Make symbol da7219_dai_clk static
Fixes the following sparse warning: sound/soc/amd/acp-da7219-max98357a.c:46:12: warning: symbol 'da7219_dai_clk' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- sound/soc/amd/acp-da7219-max98357a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index b205c78..f41560e 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -43,7 +43,7 @@ #define DUAL_CHANNEL 2 static struct snd_soc_jack cz_jack; -struct clk *da7219_dai_clk; +static struct clk *da7219_dai_clk; static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) {
[PATCH -next] ASoC: amd: acp-da7219-max98357: Make symbol da7219_dai_clk static
Fixes the following sparse warning: sound/soc/amd/acp-da7219-max98357a.c:46:12: warning: symbol 'da7219_dai_clk' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- sound/soc/amd/acp-da7219-max98357a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index b205c78..f41560e 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -43,7 +43,7 @@ #define DUAL_CHANNEL 2 static struct snd_soc_jack cz_jack; -struct clk *da7219_dai_clk; +static struct clk *da7219_dai_clk; static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) {
[PATCH -next] drm/amdgpu: fix error return code in amdgpu_amdkfd_gpuvm_create_process_vm()
Fix to return error code -ENOMEM from the eviction fence create fail error handling case instead of 0, as done elsewhere in this function. Fixes: a46a2cd103a8 ("drm/amdgpu: Add GPUVM memory management functions for KFD") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index a12a165..c5c9c6f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -846,6 +846,7 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm, current->mm); if (!info->eviction_fence) { pr_err("Failed to create eviction fence\n"); + ret = -ENOMEM; goto create_evict_fence_fail; }
[PATCH -next] drm/amdgpu: fix error return code in amdgpu_amdkfd_gpuvm_create_process_vm()
Fix to return error code -ENOMEM from the eviction fence create fail error handling case instead of 0, as done elsewhere in this function. Fixes: a46a2cd103a8 ("drm/amdgpu: Add GPUVM memory management functions for KFD") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index a12a165..c5c9c6f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -846,6 +846,7 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm, current->mm); if (!info->eviction_fence) { pr_err("Failed to create eviction fence\n"); + ret = -ENOMEM; goto create_evict_fence_fail; }
[PATCH -next] bus: fsl-mc: Remove duplicated includes
Remove duplicated include. Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/bus/fsl-mc/dpbp.c | 1 - drivers/bus/fsl-mc/dpcon.c | 1 - 2 file changed, 2 deletion(-) diff --git a/drivers/bus/fsl-mc/dpbp.c b/drivers/bus/fsl-mc/dpbp.c index 0aeacc5..9a7faab 100644 --- a/drivers/bus/fsl-mc/dpbp.c +++ b/drivers/bus/fsl-mc/dpbp.c @@ -5,7 +5,6 @@ */ #include #include -#include #include "fsl-mc-private.h" diff --git a/drivers/bus/fsl-mc/dpcon.c b/drivers/bus/fsl-mc/dpcon.c index a1ba819..b5c968d 100644 --- a/drivers/bus/fsl-mc/dpcon.c +++ b/drivers/bus/fsl-mc/dpcon.c @@ -5,7 +5,6 @@ */ #include #include -#include #include "fsl-mc-private.h"
[PATCH -next] bus: fsl-mc: Remove duplicated includes
Remove duplicated include. Signed-off-by: Wei Yongjun --- drivers/bus/fsl-mc/dpbp.c | 1 - drivers/bus/fsl-mc/dpcon.c | 1 - 2 file changed, 2 deletion(-) diff --git a/drivers/bus/fsl-mc/dpbp.c b/drivers/bus/fsl-mc/dpbp.c index 0aeacc5..9a7faab 100644 --- a/drivers/bus/fsl-mc/dpbp.c +++ b/drivers/bus/fsl-mc/dpbp.c @@ -5,7 +5,6 @@ */ #include #include -#include #include "fsl-mc-private.h" diff --git a/drivers/bus/fsl-mc/dpcon.c b/drivers/bus/fsl-mc/dpcon.c index a1ba819..b5c968d 100644 --- a/drivers/bus/fsl-mc/dpcon.c +++ b/drivers/bus/fsl-mc/dpcon.c @@ -5,7 +5,6 @@ */ #include #include -#include #include "fsl-mc-private.h"
[PATCH -next] dm verity: make some functions static
Fixes the following sparse warnings: drivers/md/dm-verity-target.c:375:6: warning: symbol 'verity_for_io_block' was not declared. Should it be static? drivers/md/dm-verity-target.c:403:14: warning: symbol 'verity_calc_buffs_for_bv' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/md/dm-verity-target.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index da35f0e..e70d4d2 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -372,9 +372,9 @@ int verity_hash_for_block(struct dm_verity *v, struct dm_verity_io *io, /* * Calculates the digest for the given bio */ -void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, -struct bvec_iter *iter, struct scatterlist *sg, -unsigned int *nents, unsigned int *total_len) +static void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, + struct bvec_iter *iter, struct scatterlist *sg, + unsigned int *nents, unsigned int *total_len) { unsigned int todo = 1 << v->data_dev_block_bits; struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); @@ -400,8 +400,9 @@ void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, * Calculate how many buffers are required to accommodate * bio_vec starting from iter. */ -unsigned int verity_calc_buffs_for_bv(struct dm_verity *v, struct dm_verity_io *io, - struct bvec_iter *iter) +static unsigned int verity_calc_buffs_for_bv(struct dm_verity *v, +struct dm_verity_io *io, +struct bvec_iter *iter) { unsigned int todo = 1 << v->data_dev_block_bits; struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
[PATCH -next] dm verity: make some functions static
Fixes the following sparse warnings: drivers/md/dm-verity-target.c:375:6: warning: symbol 'verity_for_io_block' was not declared. Should it be static? drivers/md/dm-verity-target.c:403:14: warning: symbol 'verity_calc_buffs_for_bv' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- drivers/md/dm-verity-target.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index da35f0e..e70d4d2 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -372,9 +372,9 @@ int verity_hash_for_block(struct dm_verity *v, struct dm_verity_io *io, /* * Calculates the digest for the given bio */ -void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, -struct bvec_iter *iter, struct scatterlist *sg, -unsigned int *nents, unsigned int *total_len) +static void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, + struct bvec_iter *iter, struct scatterlist *sg, + unsigned int *nents, unsigned int *total_len) { unsigned int todo = 1 << v->data_dev_block_bits; struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); @@ -400,8 +400,9 @@ void verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, * Calculate how many buffers are required to accommodate * bio_vec starting from iter. */ -unsigned int verity_calc_buffs_for_bv(struct dm_verity *v, struct dm_verity_io *io, - struct bvec_iter *iter) +static unsigned int verity_calc_buffs_for_bv(struct dm_verity *v, +struct dm_verity_io *io, +struct bvec_iter *iter) { unsigned int todo = 1 << v->data_dev_block_bits; struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
[PATCH -next] powerpc: Fix error return code in ppc4xx_msi_probe()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- arch/powerpc/platforms/4xx/msi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/4xx/msi.c b/arch/powerpc/platforms/4xx/msi.c index 4b859c8..0b71c52 100644 --- a/arch/powerpc/platforms/4xx/msi.c +++ b/arch/powerpc/platforms/4xx/msi.c @@ -241,7 +241,8 @@ static int ppc4xx_msi_probe(struct platform_device *dev) if (!msi_irqs) return -ENODEV; - if (ppc4xx_setup_pcieh_hw(dev, res, msi)) + err = ppc4xx_setup_pcieh_hw(dev, res, msi) + if (err) goto error_out; err = ppc4xx_msi_init_allocator(dev, msi);
[PATCH -next] powerpc: Fix error return code in ppc4xx_msi_probe()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- arch/powerpc/platforms/4xx/msi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/4xx/msi.c b/arch/powerpc/platforms/4xx/msi.c index 4b859c8..0b71c52 100644 --- a/arch/powerpc/platforms/4xx/msi.c +++ b/arch/powerpc/platforms/4xx/msi.c @@ -241,7 +241,8 @@ static int ppc4xx_msi_probe(struct platform_device *dev) if (!msi_irqs) return -ENODEV; - if (ppc4xx_setup_pcieh_hw(dev, res, msi)) + err = ppc4xx_setup_pcieh_hw(dev, res, msi) + if (err) goto error_out; err = ppc4xx_msi_init_allocator(dev, msi);
[PATCH -next] afs: Make symbol 'afs_cell_gc_delay' static
Fixes the following sparse warnings: fs/afs/cell.c:21:24: warning: symbol 'afs_cell_gc_delay' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- fs/afs/cell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/afs/cell.c b/fs/afs/cell.c index 3d2c5e0..c17e03b 100644 --- a/fs/afs/cell.c +++ b/fs/afs/cell.c @@ -18,7 +18,7 @@ #include #include "internal.h" -unsigned __read_mostly afs_cell_gc_delay = 10; +static unsigned __read_mostly afs_cell_gc_delay = 10; static void afs_manage_cell(struct work_struct *);
[PATCH -next] afs: Make symbol 'afs_cell_gc_delay' static
Fixes the following sparse warnings: fs/afs/cell.c:21:24: warning: symbol 'afs_cell_gc_delay' was not declared. Should it be static? Signed-off-by: Wei Yongjun --- fs/afs/cell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/afs/cell.c b/fs/afs/cell.c index 3d2c5e0..c17e03b 100644 --- a/fs/afs/cell.c +++ b/fs/afs/cell.c @@ -18,7 +18,7 @@ #include #include "internal.h" -unsigned __read_mostly afs_cell_gc_delay = 10; +static unsigned __read_mostly afs_cell_gc_delay = 10; static void afs_manage_cell(struct work_struct *);
[PATCH -next] staging: mt7621-eth: fix return value check in mt7621_gsw_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: f079b6406348 ("staging: mt7621-eth: add gigabit switch driver (GSW)") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/staging/mt7621-eth/gsw_mt7621.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/gsw_mt7621.c b/drivers/staging/mt7621-eth/gsw_mt7621.c index b49ee94..ce8d7d7 100644 --- a/drivers/staging/mt7621-eth/gsw_mt7621.c +++ b/drivers/staging/mt7621-eth/gsw_mt7621.c @@ -263,8 +263,8 @@ static int mt7621_gsw_probe(struct platform_device *pdev) return -ENOMEM; gsw->base = devm_ioremap_resource(>dev, res); - if (!gsw->base) - return -EADDRNOTAVAIL; + if (IS_ERR(gsw->base)) + return PTR_ERR(gsw->base); gsw->dev = >dev; gsw->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
[PATCH -next] staging: mt7621-eth: fix return value check in mt7621_gsw_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: f079b6406348 ("staging: mt7621-eth: add gigabit switch driver (GSW)") Signed-off-by: Wei Yongjun --- drivers/staging/mt7621-eth/gsw_mt7621.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/gsw_mt7621.c b/drivers/staging/mt7621-eth/gsw_mt7621.c index b49ee94..ce8d7d7 100644 --- a/drivers/staging/mt7621-eth/gsw_mt7621.c +++ b/drivers/staging/mt7621-eth/gsw_mt7621.c @@ -263,8 +263,8 @@ static int mt7621_gsw_probe(struct platform_device *pdev) return -ENOMEM; gsw->base = devm_ioremap_resource(>dev, res); - if (!gsw->base) - return -EADDRNOTAVAIL; + if (IS_ERR(gsw->base)) + return PTR_ERR(gsw->base); gsw->dev = >dev; gsw->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
[PATCH -next] staging: mt7621-eth: fix return value check in mtk_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/staging/mt7621-eth/mtk_eth_soc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c b/drivers/staging/mt7621-eth/mtk_eth_soc.c index 98b4462..dea4270 100644 --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c @@ -2077,8 +2077,8 @@ static int mtk_probe(struct platform_device *pdev) return -ENOMEM; eth->base = devm_ioremap_resource(>dev, res); - if (!eth->base) - return -EADDRNOTAVAIL; + if (IS_ERR(eth->base)) + return PTR_ERR(eth->base); spin_lock_init(>page_lock);
[PATCH -next] staging: mt7621-eth: fix return value check in mtk_connect_phy_node()
In case of error, the function of_phy_connect() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/staging/mt7621-eth/mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/mdio.c b/drivers/staging/mt7621-eth/mdio.c index 96ecda9..9d71307 100644 --- a/drivers/staging/mt7621-eth/mdio.c +++ b/drivers/staging/mt7621-eth/mdio.c @@ -82,10 +82,10 @@ int mtk_connect_phy_node(struct mtk_eth *eth, struct mtk_mac *mac, phydev = of_phy_connect(eth->netdev[mac->id], phy_node, mtk_phy_link_adjust, 0, phy_mode); - if (IS_ERR(phydev)) { + if (!phydev) { dev_err(eth->dev, "could not connect to PHY\n"); eth->phy->phy_node[port] = NULL; - return PTR_ERR(phydev); + return -ENODEV; } phydev->supported &= PHY_GBIT_FEATURES;
[PATCH -next] staging: mt7621-eth: fix return value check in mtk_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun --- drivers/staging/mt7621-eth/mtk_eth_soc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c b/drivers/staging/mt7621-eth/mtk_eth_soc.c index 98b4462..dea4270 100644 --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c @@ -2077,8 +2077,8 @@ static int mtk_probe(struct platform_device *pdev) return -ENOMEM; eth->base = devm_ioremap_resource(>dev, res); - if (!eth->base) - return -EADDRNOTAVAIL; + if (IS_ERR(eth->base)) + return PTR_ERR(eth->base); spin_lock_init(>page_lock);
[PATCH -next] staging: mt7621-eth: fix return value check in mtk_connect_phy_node()
In case of error, the function of_phy_connect() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun --- drivers/staging/mt7621-eth/mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-eth/mdio.c b/drivers/staging/mt7621-eth/mdio.c index 96ecda9..9d71307 100644 --- a/drivers/staging/mt7621-eth/mdio.c +++ b/drivers/staging/mt7621-eth/mdio.c @@ -82,10 +82,10 @@ int mtk_connect_phy_node(struct mtk_eth *eth, struct mtk_mac *mac, phydev = of_phy_connect(eth->netdev[mac->id], phy_node, mtk_phy_link_adjust, 0, phy_mode); - if (IS_ERR(phydev)) { + if (!phydev) { dev_err(eth->dev, "could not connect to PHY\n"); eth->phy->phy_node[port] = NULL; - return PTR_ERR(phydev); + return -ENODEV; } phydev->supported &= PHY_GBIT_FEATURES;
[PATCH -next] staging: mt7621-gpio: mt7621: make symbol gc_map static
Fixes the following sparse warning: drivers/staging/mt7621-gpio/gpio-mt7621.c:47:3: warning: symbol 'gc_map' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> --- drivers/staging/mt7621-gpio/gpio-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c index 5c57abe..d00c1cd 100644 --- a/drivers/staging/mt7621-gpio/gpio-mt7621.c +++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c @@ -38,7 +38,7 @@ enum mediatek_gpio_reg { static int mediatek_gpio_irq; static struct irq_domain *mediatek_gpio_irq_domain; -struct mtk_gc { +static struct mtk_gc { struct gpio_chip chip; spinlock_t lock; int bank;