Acked-by: Kurt Van Dijck <dev.kurt@xxxxxxxxxxxxxxxxxxxxxx> On Wed, 02 Dec 2020 23:16:32 +0800, Zhang Qilong wrote: > > If softing_netdev_open failed, we should call > close_candev to avoid reference leak. > > Fixes: 03fd3cf5a179d ("can: add driver for Softing card") > Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx> > --- > drivers/net/can/softing/softing_main.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c > index 03a68bb486fd..40070c930202 100644 > --- a/drivers/net/can/softing/softing_main.c > +++ b/drivers/net/can/softing/softing_main.c > @@ -382,8 +382,13 @@ static int softing_netdev_open(struct net_device *ndev) > > /* check or determine and set bittime */ > ret = open_candev(ndev); > - if (!ret) > - ret = softing_startstop(ndev, 1); > + if (ret) > + return ret; > + > + ret = softing_startstop(ndev, 1); > + if (ret < 0) > + close_candev(ndev); > + > return ret; > } > > -- > 2.25.4 >