Message ID | 20210212171043.2136580-1-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 8409f942a1f8c28296910b7b1d60f27dd3e03162 |
Headers | show |
Series | [1/2] libnvdimm: simplify nvdimm_remove() | expand |
On Fri, Feb 12, 2021 at 9:11 AM Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 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.
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);
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 <u.kleine-koenig@pengutronix.de> --- drivers/nvdimm/dimm.c | 3 --- 1 file changed, 3 deletions(-) base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e