Linux Kernel Mentees Archive on lore.kernel.org
 help / color / Atom feed
* [Linux-kernel-mentees] [PATCH] media: dvb_dummy_fe: Add error messages in case of attach failure
@ 2019-11-07  1:37 Daniel W. S. Almeida
  2019-11-30  6:54 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel W. S. Almeida @ 2019-11-07  1:37 UTC (permalink / raw)
  To: mchehab, gregkh, rfontana, kstewart, tglx
  Cc: linux-kernel, linux-media, linux-kernel-mentees, Daniel W. S. Almeida

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

Complain if the attach functions fail, for any reason. This is helpful
when debugging.

Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
---
 drivers/media/dvb-frontends/dvb_dummy_fe.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c
index 4db679cb70ad..ca86857c3667 100644
--- a/drivers/media/dvb-frontends/dvb_dummy_fe.c
+++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c
@@ -114,12 +114,16 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
 	if (!state)
-		return NULL;
+		goto err;
 
 	/* create dvb_frontend */
 	memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
 	state->frontend.demodulator_priv = state;
 	return &state->frontend;
+
+err:
+	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
+	return NULL;
 }
 
 static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
@@ -131,12 +135,16 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
 	if (!state)
-		return NULL;
+		goto err;
 
 	/* create dvb_frontend */
 	memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
 	state->frontend.demodulator_priv = state;
 	return &state->frontend;
+
+err:
+	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
+	return NULL;
 }
 
 static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
@@ -148,12 +156,16 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
 	if (!state)
-		return NULL;
+		goto err;
 
 	/* create dvb_frontend */
 	memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
 	state->frontend.demodulator_priv = state;
 	return &state->frontend;
+
+err:
+	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
+	return NULL;
 }
 
 static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
-- 
2.24.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [Linux-kernel-mentees] [PATCH] media: dvb_dummy_fe: Add error messages in case of attach failure
  2019-11-07  1:37 [Linux-kernel-mentees] [PATCH] media: dvb_dummy_fe: Add error messages in case of attach failure Daniel W. S. Almeida
@ 2019-11-30  6:54 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2019-11-30  6:54 UTC (permalink / raw)
  To: Daniel W. S. Almeida
  Cc: kstewart, linux-kernel, rfontana, tglx, linux-kernel-mentees,
	linux-media

Em Wed,  6 Nov 2019 22:37:45 -0300
"Daniel W. S. Almeida" <dwlsalmeida@gmail.com> escreveu:

> From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
> 
> Complain if the attach functions fail, for any reason. This is helpful
> when debugging.
> 
> Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>

Looks OK to me.

> ---
>  drivers/media/dvb-frontends/dvb_dummy_fe.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> index 4db679cb70ad..ca86857c3667 100644
> --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c
> +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> @@ -114,12 +114,16 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
>  	/* allocate memory for the internal state */
>  	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
>  	if (!state)
> -		return NULL;
> +		goto err;
>  
>  	/* create dvb_frontend */
>  	memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
>  	state->frontend.demodulator_priv = state;
>  	return &state->frontend;
> +
> +err:
> +	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
> +	return NULL;
>  }
>  
>  static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
> @@ -131,12 +135,16 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
>  	/* allocate memory for the internal state */
>  	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
>  	if (!state)
> -		return NULL;
> +		goto err;
>  
>  	/* create dvb_frontend */
>  	memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
>  	state->frontend.demodulator_priv = state;
>  	return &state->frontend;
> +
> +err:
> +	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
> +	return NULL;
>  }
>  
>  static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
> @@ -148,12 +156,16 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
>  	/* allocate memory for the internal state */
>  	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
>  	if (!state)
> -		return NULL;
> +		goto err;
>  
>  	/* create dvb_frontend */
>  	memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
>  	state->frontend.demodulator_priv = state;
>  	return &state->frontend;
> +
> +err:
> +	pr_err("%s: DVB Dummy frontend driver attach failed\n", __func__);
> +	return NULL;
>  }
>  
>  static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {



Cheers,
Mauro
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07  1:37 [Linux-kernel-mentees] [PATCH] media: dvb_dummy_fe: Add error messages in case of attach failure Daniel W. S. Almeida
2019-11-30  6:54 ` Mauro Carvalho Chehab

Linux Kernel Mentees Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-kernel-mentees/0 linux-kernel-mentees/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-kernel-mentees linux-kernel-mentees/ https://lore.kernel.org/linux-kernel-mentees \
		linux-kernel-mentees@lists.linuxfoundation.org
	public-inbox-index linux-kernel-mentees

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxfoundation.lists.linux-kernel-mentees


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git