netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init()
@ 2019-11-06 14:59 Wei Yongjun
  2019-11-07  0:00 ` [EXT] " Igor Russkikh
  2019-11-07  5:22 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-11-06 14:59 UTC (permalink / raw)
  To: Egor Pomozov, Igor Russkikh; +Cc: Wei Yongjun, netdev, kernel-janitors

Function ptp_clock_register() returns ERR_PTR() and never returns
NULL. The NULL test should be removed.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 3ec08415e53e..252a80b6d3b6 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -1205,7 +1205,7 @@ int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
 	aq_ptp->ptp_info = aq_ptp_clock;
 	aq_ptp_gpio_init(&aq_ptp->ptp_info, &mbox.info);
 	clock = ptp_clock_register(&aq_ptp->ptp_info, &aq_nic->ndev->dev);
-	if (!clock || IS_ERR(clock)) {
+	if (IS_ERR(clock)) {
 		netdev_err(aq_nic->ndev, "ptp_clock_register failed\n");
 		err = PTR_ERR(clock);
 		goto err_exit;




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

* Re: [EXT] [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init()
  2019-11-06 14:59 [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init() Wei Yongjun
@ 2019-11-07  0:00 ` Igor Russkikh
  2019-11-07  5:22 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Russkikh @ 2019-11-07  0:00 UTC (permalink / raw)
  To: Wei Yongjun, Egor Pomozov, Igor Russkikh; +Cc: netdev, kernel-janitors


> Function ptp_clock_register() returns ERR_PTR() and never returns
> NULL. The NULL test should be removed.

Thanks, Wei!

Function by itself could return null, but you are right, since this
code is now active only when PTP_1588_CLOCK is on - this is a useless check then.

> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> index 3ec08415e53e..252a80b6d3b6 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> @@ -1205,7 +1205,7 @@ int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
>  	aq_ptp->ptp_info = aq_ptp_clock;
>  	aq_ptp_gpio_init(&aq_ptp->ptp_info, &mbox.info);
>  	clock = ptp_clock_register(&aq_ptp->ptp_info, &aq_nic->ndev->dev);
> -	if (!clock || IS_ERR(clock)) {
> +	if (IS_ERR(clock)) {
>  		netdev_err(aq_nic->ndev, "ptp_clock_register failed\n");
>  		err = PTR_ERR(clock);
>  		goto err_exit;

Acked-by: Igor Russkikh <irusskikh@marvell.com>

-- 
Regards,
  Igor

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

* Re: [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init()
  2019-11-06 14:59 [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init() Wei Yongjun
  2019-11-07  0:00 ` [EXT] " Igor Russkikh
@ 2019-11-07  5:22 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-07  5:22 UTC (permalink / raw)
  To: weiyongjun1; +Cc: epomozov, igor.russkikh, netdev, kernel-janitors

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Wed, 6 Nov 2019 14:59:21 +0000

> Function ptp_clock_register() returns ERR_PTR() and never returns
> NULL. The NULL test should be removed.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

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

end of thread, other threads:[~2019-11-07  5:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 14:59 [PATCH net-next] net: aquantia: fix return value check in aq_ptp_init() Wei Yongjun
2019-11-07  0:00 ` [EXT] " Igor Russkikh
2019-11-07  5:22 ` David Miller

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