lkml.org 
[lkml]   [2023]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net] forcedeth: Fix an error handling path in nv_probe()
On Sat, May 20, 2023 at 10:30:17AM +0200, Christophe JAILLET wrote:
> If an error occures after calling nv_mgmt_acquire_sema(), it should be
> undone with a corresponding nv_mgmt_release_sema() call.

nit: s/occures/occurs/

>
> Add it in the error handling path of the probe as already done in the
> remove function.

I was going to ask what happens if nv_mgmt_acquire_sema() fails.
Then I realised that it always returns 0.

Perhaps it would be worth changing it's return type to void at some point.

> Fixes: cac1c52c3621 ("forcedeth: mgmt unit interface")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I don't think that the Fixes tag is really accurate, but
> nv_mgmt_release_sema() was introduced here. And cac1c52c3621 is already old
> so should be good enough.
> ---
> drivers/net/ethernet/nvidia/forcedeth.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> index 0605d1ee490d..7a549b834e97 100644
> --- a/drivers/net/ethernet/nvidia/forcedeth.c
> +++ b/drivers/net/ethernet/nvidia/forcedeth.c
> @@ -6138,6 +6138,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
> return 0;
>
> out_error:
> + nv_mgmt_release_sema(dev);
> if (phystate_orig)
> writel(phystate|NVREG_ADAPTCTL_RUNNING, base + NvRegAdapterControl);
> out_freering:
> --
> 2.34.1
>
>

\
 
 \ /
  Last update: 2023-05-22 12:14    [W:0.084 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site