linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dvb: check status of mxl111sf_read_reg
@ 2018-12-26  5:58 Kangjie Lu
  2018-12-27  3:47 ` Michael Ira Krufky
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26  5:58 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Michael Krufky, Mauro Carvalho Chehab, linux-media,
	linux-kernel

When mxl111sf_read_reg fails, we shouldn't use "mode". The fix checks
its return value using mxl_fail

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
index ffb6e7c72f57..aecc3d02fc1e 100644
--- a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
+++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
@@ -130,7 +130,8 @@ int mxl111sf_config_mpeg_in(struct mxl111sf_state *state,
 	mxl_fail(ret);
 
 	/* Configure MPEG Clock phase */
-	mxl111sf_read_reg(state, V6_MPEG_IN_CLK_INV_REG, &mode);
+	ret = mxl111sf_read_reg(state, V6_MPEG_IN_CLK_INV_REG, &mode);
+	mxl_fail(ret);
 
 	if (clock_phase == TSIF_NORMAL)
 		mode &= ~V6_INVERTED_CLK_PHASE;
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] usb: dvb: check status of mxl111sf_read_reg
  2018-12-26  5:58 [PATCH] usb: dvb: check status of mxl111sf_read_reg Kangjie Lu
@ 2018-12-27  3:47 ` Michael Ira Krufky
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ira Krufky @ 2018-12-27  3:47 UTC (permalink / raw)
  To: Kangjie Lu; +Cc: pakki001, Mauro Carvalho Chehab, linux-media, LKML

Kangjie,

On Wed, Dec 26, 2018 at 12:59 AM Kangjie Lu <kjlu@umn.edu> wrote:
>
> When mxl111sf_read_reg fails, we shouldn't use "mode". The fix checks
> its return value using mxl_fail
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
> index ffb6e7c72f57..aecc3d02fc1e 100644
> --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
> +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c
> @@ -130,7 +130,8 @@ int mxl111sf_config_mpeg_in(struct mxl111sf_state *state,
>         mxl_fail(ret);
>
>         /* Configure MPEG Clock phase */
> -       mxl111sf_read_reg(state, V6_MPEG_IN_CLK_INV_REG, &mode);
> +       ret = mxl111sf_read_reg(state, V6_MPEG_IN_CLK_INV_REG, &mode);
> +       mxl_fail(ret);
>
>         if (clock_phase == TSIF_NORMAL)
>                 mode &= ~V6_INVERTED_CLK_PHASE;
> --
> 2.17.2 (Apple Git-113)

It *looks* correct, however....

If I recall correctly, this chip will often fail when reading
registers.   Notice, `mode` is initialized to zero at first, and not
again touched before being passed to the readreg function - this is on
purpose.   The value remains untouched if the read fails. ....and the
read _wil_ fail.  Maybe not always, but sometimes.

When you run with the patch applied, does it just spew errors?

-Mike

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

end of thread, other threads:[~2018-12-27  3:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26  5:58 [PATCH] usb: dvb: check status of mxl111sf_read_reg Kangjie Lu
2018-12-27  3:47 ` Michael Ira Krufky

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).