public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: bttv-driver.c:3964: error: void value not ignored as it ought to be
       [not found] <20060717124505.GD7281@neu.nirvana>
@ 2006-07-17 19:53 ` Michael Krufky
  2006-07-17 20:55   ` Nish Aravamudan
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Krufky @ 2006-07-17 19:53 UTC (permalink / raw)
  To: Linux and Kernel Video
  Cc: Randy Dunlap, Andrew Morton, Mauro Carvalho Chehab, linux-kernel,
	Axel Thimm

Axel Thimm wrote:
> latest hg fails on > 2.6.17 due to video_device_create_file being void
> but still being asked for a return value in bttv-driver.c
> 
> linux/drivers/media/video/bt8xx/bttv-driver.c:
> 
>    3963 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
>    3964         ret = video_device_create_file(btv->video_dev, &class_device_attr_card);
>    3965         if (ret < 0)
> 
> 
> linux/include/media/v4l2-dev.h:
> 
>     379 static inline void
>     380 video_device_create_file(struct video_device *vfd,
>     381                          struct class_device_attribute *attr)
>     382 {
> 
>   CC [M]  /builddir/video4linux-20060717/v4l/flexcop-dma.o
>   CC [M]  /builddir/video4linux-20060717/v4l/bttv-driver.o
> /builddir/video4linux-20060717/v4l/bttv-driver.c: In function 'bttv_register_video':
> /builddir/video4linux-20060717/v4l/bttv-driver.c:3964: error: void value not ignored as it ought to be
> /builddir/video4linux-20060717/v4l/bttv-driver.c: In function 'bttv_probe':
> /builddir/video4linux-20060717/v4l/bttv-driver.c:4074: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'resource_size_t'
> /builddir/video4linux-20060717/v4l/bttv-driver.c:4086: warning: format '%lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'
> make[3]: *** [/builddir/video4linux-20060717/v4l/bttv-driver.o] Error 1

Hmmm... This was caused by the "Check all __must_check warnings in
bttv." patch from Randy Dunlap (cc's from original thread added)

I am aware that this was done for various reasons of sanity checking,
however, we cannot check the return value of a void ;-)

-Mike
-- 
Michael Krufky


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bttv-driver.c:3964: error: void value not ignored as it ought to be
  2006-07-17 19:53 ` bttv-driver.c:3964: error: void value not ignored as it ought to be Michael Krufky
@ 2006-07-17 20:55   ` Nish Aravamudan
  2006-07-17 21:30     ` Michael Krufky
  0 siblings, 1 reply; 5+ messages in thread
From: Nish Aravamudan @ 2006-07-17 20:55 UTC (permalink / raw)
  To: Michael Krufky
  Cc: Linux and Kernel Video, Randy Dunlap, Andrew Morton,
	Mauro Carvalho Chehab, linux-kernel, Axel Thimm

On 7/17/06, Michael Krufky <mkrufky@linuxtv.org> wrote:
> Axel Thimm wrote:
> > latest hg fails on > 2.6.17 due to video_device_create_file being void
> > but still being asked for a return value in bttv-driver.c
> >
> > linux/drivers/media/video/bt8xx/bttv-driver.c:
> >
> >    3963 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
> >    3964         ret = video_device_create_file(btv->video_dev, class_device_attr_card);
> >    3965         if (ret < 0)
> >
> >
> > linux/include/media/v4l2-dev.h:
> >
> >     379 static inline void
> >     380 video_device_create_file(struct video_device *vfd,
> >     381                          struct class_device_attribute *attr)
> >     382 {
> >

<snip>

> Hmmm... This was caused by the "Check all __must_check warnings in
> bttv." patch from Randy Dunlap (cc's from original thread added)
>
> I am aware that this was done for various reasons of sanity checking,
> however, we cannot check the return value of a void ;-)

For the sanity checking, I don't think video_device_create_file()
should be a void function. It probably should return
class_device_create_file()'s return value, no? As it can fail...

Thanks,
Nish

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bttv-driver.c:3964: error: void value not ignored as it ought to be
  2006-07-17 20:55   ` Nish Aravamudan
@ 2006-07-17 21:30     ` Michael Krufky
  2006-07-18  3:03       ` Michael Krufky
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Krufky @ 2006-07-17 21:30 UTC (permalink / raw)
  To: Linux and Kernel Video
  Cc: Michael Krufky, Andrew Morton, Axel Thimm, linux-kernel,
	Mauro Carvalho Chehab, Randy Dunlap

Nish Aravamudan wrote:
> On 7/17/06, Michael Krufky <mkrufky@linuxtv.org> wrote:
>> Axel Thimm wrote:
>> > latest hg fails on > 2.6.17 due to video_device_create_file being void
>> > but still being asked for a return value in bttv-driver.c
>> >
>> > linux/drivers/media/video/bt8xx/bttv-driver.c:
>> >
>> >    3963 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
>> >    3964         ret = video_device_create_file(btv->video_dev,
>> class_device_attr_card);
>> >    3965         if (ret < 0)
>> >
>> >
>> > linux/include/media/v4l2-dev.h:
>> >
>> >     379 static inline void
>> >     380 video_device_create_file(struct video_device *vfd,
>> >     381                          struct class_device_attribute *attr)
>> >     382 {
>> >
> 
> <snip>
> 
>> Hmmm... This was caused by the "Check all __must_check warnings in
>> bttv." patch from Randy Dunlap (cc's from original thread added)
>>
>> I am aware that this was done for various reasons of sanity checking,
>> however, we cannot check the return value of a void ;-)
> 
> For the sanity checking, I don't think video_device_create_file()
> should be a void function. It probably should return
> class_device_create_file()'s return value, no? As it can fail...
> 

You are correct... I was merely pointing out the error, but now I see it
runs deeper than I had thought.  I will fix both
video_device_create_file and video_device_remove_file to return the
class_device_foo return values, then I'll push it over to Mauro.

Cheers,

Michael Krufky


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bttv-driver.c:3964: error: void value not ignored as it ought to be
  2006-07-17 21:30     ` Michael Krufky
@ 2006-07-18  3:03       ` Michael Krufky
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Krufky @ 2006-07-18  3:03 UTC (permalink / raw)
  To: Linux and Kernel Video
  Cc: Andrew Morton, Axel Thimm, linux-kernel, Mauro Carvalho Chehab,
	Randy Dunlap

Michael Krufky wrote:
> Nish Aravamudan wrote:
>> On 7/17/06, Michael Krufky <mkrufky@linuxtv.org> wrote:
>>> Hmmm... This was caused by the "Check all __must_check warnings in
>>> bttv." patch from Randy Dunlap (cc's from original thread added)
>>>
>>> I am aware that this was done for various reasons of sanity checking,
>>> however, we cannot check the return value of a void ;-)
>> For the sanity checking, I don't think video_device_create_file()
>> should be a void function. It probably should return
>> class_device_create_file()'s return value, no? As it can fail...
>>
> 
> You are correct... I was merely pointing out the error, but now I see it
> runs deeper than I had thought.  I will fix both
> video_device_create_file and video_device_remove_file to return the
> class_device_foo return values, then I'll push it over to Mauro.

I was in a rush when I wrote that, and I wasn't thinking. 
video_device_remove_file stays as a void.

Anyway, here is the fix.  This is already in my tree ( 
http://linuxtv.org/hg/~mkrufky/v4l-dvb ) but split into separate patches.

no s-o-b needed for now -- this will come up through Mauro.

diff -upr master/linux/drivers/media/video/bt8xx/bttv-driver.c 
v4l-dvb/linux/drivers/media/video/bt8xx/bttv-driver.c
--- master/linux/drivers/media/video/bt8xx/bttv-driver.c 
2006-07-17 22:57:05.000000000 -0400
+++ v4l-dvb/linux/drivers/media/video/bt8xx/bttv-driver.c 
2006-07-17 21:55:54.000000000 -0400
@@ -3942,10 +3942,6 @@ static void bttv_unregister_video(struct
  /* register video4linux devices */
  static int __devinit bttv_register_video(struct bttv *btv)
  {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
-       int ret;
-#endif
-
         if (no_overlay <= 0) {
                 bttv_video_template.type |= VID_TYPE_OVERLAY;
         } else {
@@ -3960,17 +3956,10 @@ static int __devinit bttv_register_video
                 goto err;
         printk(KERN_INFO "bttv%d: registered device video%d\n",
                btv->c.nr,btv->video_dev->minor & 0x1f);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
-       ret = video_device_create_file(btv->video_dev, 
&class_device_attr_card);
-       if (ret < 0)
-               printk(KERN_WARNING "bttv: video_device_create_file error: "
-                       "%d\n", ret);
-#else
  #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)

         video_device_create_file(btv->video_dev, &class_device_attr_card);
  #endif
-#endif

         /* vbi */
         btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
diff -upr master/linux/include/media/v4l2-dev.h 
v4l-dvb/linux/include/media/v4l2-dev.h
--- master/linux/include/media/v4l2-dev.h       2006-07-17 
22:57:06.000000000 -0400
+++ v4l-dvb/linux/include/media/v4l2-dev.h      2006-07-17 
22:34:32.000000000 -0400
@@ -376,11 +376,14 @@ extern struct video_device* video_devdat

  #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
  #define to_video_device(cd) container_of(cd, struct video_device, 
class_dev)
-static inline void
+static inline int
  video_device_create_file(struct video_device *vfd,
                          struct class_device_attribute *attr)
  {
-       class_device_create_file(&vfd->class_dev, attr);
+       int ret = class_device_create_file(&vfd->class_dev, attr);
+       if (ret < 0)
+               printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
+       return ret;
  }
  static inline void
  video_device_remove_file(struct video_device *vfd,




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bttv-driver.c:3964: error: void value not ignored as it ought to be
@ 2006-07-18  3:30 Randy Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2006-07-18  3:30 UTC (permalink / raw)
  To: Michael Krufky, Linux and Kernel Video, Andrew Morton, Axel Thimm,
	linux-kernel, Mauro Carvalho Chehab, Randy Dunlap



> Michael Krufky wrote:
> > Nish Aravamudan wrote:
> >> On 7/17/06, Michael Krufky <mkrufky@linuxtv.org> wrote:
> >>> Hmmm... This was caused by the "Check all __must_check warnings in
> >>> bttv." patch from Randy Dunlap (cc's from original thread added)
> >>>
> >>> I am aware that this was done for various reasons of sanity checking,
> >>> however, we cannot check the return value of a void ;-)
> >> For the sanity checking, I don't think video_device_create_file()
> >> should be a void function. It probably should return
> >> class_device_create_file()'s return value, no? As it can fail...
> >>
> > 
> > You are correct... I was merely pointing out the error, but now I see it
> > runs deeper than I had thought.  I will fix both
> > video_device_create_file and video_device_remove_file to return the
> > class_device_foo return values, then I'll push it over to Mauro.
> 
> I was in a rush when I wrote that, and I wasn't thinking. 
> video_device_remove_file stays as a void.
> 
> Anyway, here is the fix.  This is already in my tree ( 
> http://linuxtv.org/hg/~mkrufky/v4l-dvb ) but split into separate patches.

Hi,
Thanks for taking care of this.
I'll look over it and see what I missed.  Right now I have
terrible wireless connections/problems.  Sorry about the delay.

---
~Randy


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-18  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060717124505.GD7281@neu.nirvana>
2006-07-17 19:53 ` bttv-driver.c:3964: error: void value not ignored as it ought to be Michael Krufky
2006-07-17 20:55   ` Nish Aravamudan
2006-07-17 21:30     ` Michael Krufky
2006-07-18  3:03       ` Michael Krufky
2006-07-18  3:30 Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox