All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drx: add initial drx-d driver
@ 2017-12-14  8:03 Dan Carpenter
  2017-12-14 21:55 ` Ralph Metzler
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-12-14  8:03 UTC (permalink / raw)
  To: rjkm; +Cc: linux-media

Hello Ralph Metzler,

The patch 126f1e618870: "drx: add initial drx-d driver" from Mar 12,
2011, leads to the following static checker warning:

	drivers/media/dvb-frontends/drxd_hard.c:1305 SC_WaitForReady()
	info: return a literal instead of 'status'

drivers/media/dvb-frontends/drxd_hard.c
  1298  static int SC_WaitForReady(struct drxd_state *state)
  1299  {
  1300          int i;
  1301  
  1302          for (i = 0; i < DRXD_MAX_RETRIES; i += 1) {
  1303                  int status = Read16(state, SC_RA_RAM_CMD__A, NULL, 0);
  1304                  if (status == 0)
  1305                          return status;
                                ^^^^^^^^^^^^^
The register is set to zero when ready?  The answer should obviously be
yes, but it wouldn't totally surprise me if this function just always
looped 1000 times...  Few of the callers check the return.  Anyway, it's
more clear to just "return 0;"

  1306          }
  1307          return -1;
                       ^^
-1 is not a proper error code.

  1308  }

regards,
dan carpenter

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

* [bug report] drx: add initial drx-d driver
  2017-12-14  8:03 [bug report] drx: add initial drx-d driver Dan Carpenter
@ 2017-12-14 21:55 ` Ralph Metzler
  2017-12-15  3:05   ` Devin Heitmueller
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ralph Metzler @ 2017-12-14 21:55 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-media

Hello Dan Carpenter,

Dan Carpenter writes:
 > Hello Ralph Metzler,
 > 
 > The patch 126f1e618870: "drx: add initial drx-d driver" from Mar 12,
 > 2011, leads to the following static checker warning:
 > 
 > 	drivers/media/dvb-frontends/drxd_hard.c:1305 SC_WaitForReady()
 > 	info: return a literal instead of 'status'
 > 
 > drivers/media/dvb-frontends/drxd_hard.c
 >   1298  static int SC_WaitForReady(struct drxd_state *state)
 >   1299  {
 >   1300          int i;
 >   1301  
 >   1302          for (i = 0; i < DRXD_MAX_RETRIES; i += 1) {
 >   1303                  int status = Read16(state, SC_RA_RAM_CMD__A, NULL, 0);
 >   1304                  if (status == 0)
 >   1305                          return status;
 >                                 ^^^^^^^^^^^^^
 > The register is set to zero when ready?  The answer should obviously be
 > yes, but it wouldn't totally surprise me if this function just always
 > looped 1000 times...  Few of the callers check the return.  Anyway, it's
 > more clear to just "return 0;"
 > 
 >   1306          }
 >   1307          return -1;
 >                        ^^
 > -1 is not a proper error code.
 > 
 >   1308  }
 > 
 > regards,
 > dan carpenter

I think I wrote the driver more than 10 years ago and somebody later submitted it
to the kernel.

I don't know if there is a anybody still maintaining this. Is it even used anymore?
I could write a patch but cannot test it (e.g. to see if it really always
loops 1000 times ...)


Regards,
Ralph Metzler

-- 
--

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

* Re: [bug report] drx: add initial drx-d driver
  2017-12-14 21:55 ` Ralph Metzler
@ 2017-12-15  3:05   ` Devin Heitmueller
       [not found]   ` <CAGoCfiwkuznB71esUq00gj5+B_v37R3VfsJFHaOiPLD57veOkw@mail.gmail.com>
  2017-12-16 13:58   ` Mauro Carvalho Chehab
  2 siblings, 0 replies; 5+ messages in thread
From: Devin Heitmueller @ 2017-12-15  3:05 UTC (permalink / raw)
  To: Ralph Metzler; +Cc: Dan Carpenter, Linux Media Mailing List

> I think I wrote the driver more than 10 years ago and somebody later submitted it
> to the kernel.

I'm pretty sure that was me, or perhaps I was the first person to get
it to work with a device upstream - it was so long ago.

> I don't know if there is a anybody still maintaining this. Is it even used anymore?
> I could write a patch but cannot test it (e.g. to see if it really always
> loops 1000 times ...)

Pretty sure the register was a status register that had bits set for
pending writes, and when the transfer was complete all the bits would
be zero (at which point it should stop polling the register and bail
out).

I would have to test it to be sure, but I'm 80% confident that in
normal operation that loop only does a few iterations.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

* Re: [bug report] drx: add initial drx-d driver
       [not found]   ` <CAGoCfiwkuznB71esUq00gj5+B_v37R3VfsJFHaOiPLD57veOkw@mail.gmail.com>
@ 2017-12-16 12:04     ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-12-16 12:04 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: rjkm, Linux Media Mailing List

I'm really sorry.  This warning showed up in my new warnings pile and I
didn't look at the date.  :/  Sorry for the noise.

regards,
dan carpenter

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

* Re: [bug report] drx: add initial drx-d driver
  2017-12-14 21:55 ` Ralph Metzler
  2017-12-15  3:05   ` Devin Heitmueller
       [not found]   ` <CAGoCfiwkuznB71esUq00gj5+B_v37R3VfsJFHaOiPLD57veOkw@mail.gmail.com>
@ 2017-12-16 13:58   ` Mauro Carvalho Chehab
  2 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2017-12-16 13:58 UTC (permalink / raw)
  To: Ralph Metzler, Michael Ira Krufky; +Cc: Dan Carpenter, linux-media

Em Thu, 14 Dec 2017 22:55:02 +0100
Ralph Metzler <rjkm@metzlerbros.de> escreveu:

> Hello Dan Carpenter,
> 
> Dan Carpenter writes:
>  > Hello Ralph Metzler,
>  > 
>  > The patch 126f1e618870: "drx: add initial drx-d driver" from Mar 12,
>  > 2011, leads to the following static checker warning:
>  > 
>  > 	drivers/media/dvb-frontends/drxd_hard.c:1305 SC_WaitForReady()
>  > 	info: return a literal instead of 'status'
>  > 
>  > drivers/media/dvb-frontends/drxd_hard.c
>  >   1298  static int SC_WaitForReady(struct drxd_state *state)
>  >   1299  {
>  >   1300          int i;
>  >   1301  
>  >   1302          for (i = 0; i < DRXD_MAX_RETRIES; i += 1) {
>  >   1303                  int status = Read16(state, SC_RA_RAM_CMD__A, NULL, 0);
>  >   1304                  if (status == 0)
>  >   1305                          return status;
>  >                                 ^^^^^^^^^^^^^
>  > The register is set to zero when ready?  The answer should obviously be
>  > yes, but it wouldn't totally surprise me if this function just always
>  > looped 1000 times...  Few of the callers check the return.  Anyway, it's
>  > more clear to just "return 0;"
>  > 
>  >   1306          }
>  >   1307          return -1;
>  >                        ^^
>  > -1 is not a proper error code.
>  > 
>  >   1308  }
>  > 
>  > regards,
>  > dan carpenter  
> 
> I think I wrote the driver more than 10 years ago and somebody later submitted it
> to the kernel.
> 
> I don't know if there is a anybody still maintaining this. Is it even used anymore?
> I could write a patch but cannot test it (e.g. to see if it really always
> loops 1000 times ...)

It seems that it is used on this board (besides ngene):
	EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2
	a. k. a.: Hauppauge WinTV HVR 900 (R2)

I might have a HVR-900 rev 2 somewhere, but if so, it is not at the
usual place. I moved a few times since when I touched at the
drxd driver, at the time it was merged upstream. Maybe Michael or
someone at Hauppauge could test a patch for it, if they still have
this device.

Thanks,
Mauro

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

end of thread, other threads:[~2017-12-16 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14  8:03 [bug report] drx: add initial drx-d driver Dan Carpenter
2017-12-14 21:55 ` Ralph Metzler
2017-12-15  3:05   ` Devin Heitmueller
     [not found]   ` <CAGoCfiwkuznB71esUq00gj5+B_v37R3VfsJFHaOiPLD57veOkw@mail.gmail.com>
2017-12-16 12:04     ` Dan Carpenter
2017-12-16 13:58   ` Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.