* [PATCH v2] fbdev: lcdcfb: add missing device_remove_file()
@ 2025-02-08 9:29 oushixiong1025
2025-02-19 5:25 ` kernel test robot
2025-02-19 6:47 ` Arnd Bergmann
0 siblings, 2 replies; 4+ messages in thread
From: oushixiong1025 @ 2025-02-08 9:29 UTC (permalink / raw)
To: Helge Deller
Cc: Thomas Zimmermann, Laurent Pinchart, Lee Jones,
Uwe Kleine-König, Arnd Bergmann, linux-fbdev, dri-devel,
linux-kernel, Shixiong Ou
From: Shixiong Ou <oushixiong@kylinos.cn>
1. The device_remove_file() need to be called when driver is removing.
2. The device_remove_file() need to be called if the call to
device_create_file() fails.
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
v1->v2:
add missing 'return error'.
call device_remove_file() in sh_mobile_lcdc_overlay_fb_unregister().
drivers/video/fbdev/sh_mobile_lcdcfb.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index 4715dcb59811..c52661d5491a 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -1504,10 +1504,14 @@ static void
sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl)
{
struct fb_info *info = ovl->info;
+ unsigned int i;
if (info == NULL || info->dev == NULL)
return;
+ for (i = 0; i < ARRAY_SIZE(overlay_sysfs_attrs); ++i)
+ device_remove_file(info->dev, &overlay_sysfs_attrs[i]);
+
unregister_framebuffer(ovl->info);
}
@@ -1516,7 +1520,7 @@ sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
{
struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
struct fb_info *info = ovl->info;
- unsigned int i;
+ unsigned int i, error = 0;
int ret;
if (info == NULL)
@@ -1531,9 +1535,15 @@ sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
info->var.yres, info->var.bits_per_pixel);
for (i = 0; i < ARRAY_SIZE(overlay_sysfs_attrs); ++i) {
- ret = device_create_file(info->dev, &overlay_sysfs_attrs[i]);
- if (ret < 0)
- return ret;
+ error = device_create_file(info->dev, &overlay_sysfs_attrs[i]);
+ if (error)
+ break;
+ }
+
+ if (error) {
+ while (--i >= 0)
+ device_remove_file(info->dev, &overlay_sysfs_attrs[i]);
+ return error;
}
return 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fbdev: lcdcfb: add missing device_remove_file()
2025-02-08 9:29 [PATCH v2] fbdev: lcdcfb: add missing device_remove_file() oushixiong1025
@ 2025-02-19 5:25 ` kernel test robot
2025-02-19 6:47 ` Arnd Bergmann
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-02-19 5:25 UTC (permalink / raw)
To: oushixiong1025, Helge Deller
Cc: oe-kbuild-all, Thomas Zimmermann, Laurent Pinchart, Lee Jones,
Uwe Kleine-König, Arnd Bergmann, linux-fbdev, dri-devel,
linux-kernel, Shixiong Ou
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-leds/for-leds-next]
[also build test WARNING on linus/master v6.14-rc3 next-20250218]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/oushixiong1025-163-com/fbdev-lcdcfb-add-missing-device_remove_file/20250208-173203
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link: https://lore.kernel.org/r/20250208092918.251733-1-oushixiong1025%40163.com
patch subject: [PATCH v2] fbdev: lcdcfb: add missing device_remove_file()
config: nios2-randconfig-r072-20250219 (https://download.01.org/0day-ci/archive/20250219/202502191200.AVwVc1DY-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502191200.AVwVc1DY-lkp@intel.com/
smatch warnings:
drivers/video/fbdev/sh_mobile_lcdcfb.c:1544 sh_mobile_lcdc_overlay_fb_register() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
drivers/video/fbdev/sh_mobile_lcdcfb.c:1544 sh_mobile_lcdc_overlay_fb_register() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
drivers/video/fbdev/sh_mobile_lcdcfb.c:2652 sh_mobile_lcdc_probe() warn: 'irq' from request_irq() not released on lines: 2652.
drivers/video/fbdev/sh_mobile_lcdcfb.c:2652 sh_mobile_lcdc_probe() warn: 'priv->base' from ioremap() not released on lines: 2652.
vim +1544 drivers/video/fbdev/sh_mobile_lcdcfb.c
1517
1518 static int
1519 sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
1520 {
1521 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
1522 struct fb_info *info = ovl->info;
1523 unsigned int i, error = 0;
1524 int ret;
1525
1526 if (info == NULL)
1527 return 0;
1528
1529 ret = register_framebuffer(info);
1530 if (ret < 0)
1531 return ret;
1532
1533 dev_info(lcdc->dev, "registered %s/overlay %u as %dx%d %dbpp.\n",
1534 dev_name(lcdc->dev), ovl->index, info->var.xres,
1535 info->var.yres, info->var.bits_per_pixel);
1536
1537 for (i = 0; i < ARRAY_SIZE(overlay_sysfs_attrs); ++i) {
1538 error = device_create_file(info->dev, &overlay_sysfs_attrs[i]);
1539 if (error)
1540 break;
1541 }
1542
1543 if (error) {
> 1544 while (--i >= 0)
1545 device_remove_file(info->dev, &overlay_sysfs_attrs[i]);
1546 return error;
1547 }
1548
1549 return 0;
1550 }
1551
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fbdev: lcdcfb: add missing device_remove_file()
2025-02-08 9:29 [PATCH v2] fbdev: lcdcfb: add missing device_remove_file() oushixiong1025
2025-02-19 5:25 ` kernel test robot
@ 2025-02-19 6:47 ` Arnd Bergmann
2025-02-19 7:40 ` Shixiong Ou
1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2025-02-19 6:47 UTC (permalink / raw)
To: oushixiong, Helge Deller
Cc: Thomas Zimmermann, Laurent Pinchart, Lee Jones,
Uwe Kleine-König, linux-fbdev, dri-devel, linux-kernel,
oushixiong
On Sat, Feb 8, 2025, at 10:29, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@kylinos.cn>
>
> 1. The device_remove_file() need to be called when driver is removing.
> 2. The device_remove_file() need to be called if the call to
> device_create_file() fails.
This should probably use device_add_group() instead of
individual files to simplify both creation and removal.
It would also avoid the bug you introduced that gcc warns
about.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fbdev: lcdcfb: add missing device_remove_file()
2025-02-19 6:47 ` Arnd Bergmann
@ 2025-02-19 7:40 ` Shixiong Ou
0 siblings, 0 replies; 4+ messages in thread
From: Shixiong Ou @ 2025-02-19 7:40 UTC (permalink / raw)
To: Arnd Bergmann, Helge Deller
Cc: Thomas Zimmermann, Laurent Pinchart, Lee Jones,
Uwe Kleine-König, linux-fbdev, dri-devel, linux-kernel,
oushixiong
在 2025/2/19 14:47, Arnd Bergmann 写道:
> On Sat, Feb 8, 2025, at 10:29, oushixiong1025@163.com wrote:
>> From: Shixiong Ou <oushixiong@kylinos.cn>
>>
>> 1. The device_remove_file() need to be called when driver is removing.
>> 2. The device_remove_file() need to be called if the call to
>> device_create_file() fails.
> This should probably use device_add_group() instead of
> individual files to simplify both creation and removal.
> It would also avoid the bug you introduced that gcc warns
> about.
>
> Arnd
Thank you for your suggestion. I will incorporate your advice and resend a patch.
Thanks and Regards,
Shixiong Ou.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-19 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08 9:29 [PATCH v2] fbdev: lcdcfb: add missing device_remove_file() oushixiong1025
2025-02-19 5:25 ` kernel test robot
2025-02-19 6:47 ` Arnd Bergmann
2025-02-19 7:40 ` Shixiong Ou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).