2021-02-12 17:13:11

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 1/2] libnvdimm: simplify nvdimm_remove()

nvdimm_remove is only ever called after nvdimm_probe() returned
successfully. In this case driver data is always set to a non-NULL value
so the check for driver data being NULL can go away as it's always false.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/nvdimm/dimm.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c
index 7d4ddc4d9322..94be3ae1d29f 100644
--- a/drivers/nvdimm/dimm.c
+++ b/drivers/nvdimm/dimm.c
@@ -117,9 +117,6 @@ static int nvdimm_remove(struct device *dev)
{
struct nvdimm_drvdata *ndd = dev_get_drvdata(dev);

- if (!ndd)
- return 0;
-
nvdimm_bus_lock(dev);
dev_set_drvdata(dev, NULL);
nvdimm_bus_unlock(dev);

base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
--
2.29.2


2021-02-17 02:15:11

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 1/2] libnvdimm: simplify nvdimm_remove()

On Fri, Feb 12, 2021 at 9:11 AM Uwe Kleine-König
<[email protected]> wrote:
>
> nvdimm_remove is only ever called after nvdimm_probe() returned
> successfully. In this case driver data is always set to a non-NULL value
> so the check for driver data being NULL can go away as it's always false.

Looks good, thanks.