Skip to contentSkip to conversation

staging: kpc2000: remove unnecessary assertion on priv

PATCH In review Aditya Pakki 2 participants 2 messages Dec 17, 2019 – Dec 19, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: kpc2000: remove unnecessary assertion on priv

In kpc_dma_transfer(), the assertion that priv is NULL is never satisfied. The two callers of the function, dereference the priv pointer before the call is executed. This patch removes the unnecessary BUG_ON call.

---
v1: Replace the recovery code by removing the assertion, as suggested by Greg Kroah-Hartman.

---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/kpc2000/kpc_dma/fileops.c +0 -1
index cb52bd9a6d2f..61d762535823 100644
@@ -49,7 +49,6 @@ static int kpc_dma_transfer(struct dev_private_data *priv,
 	u64 dma_addr;
 	u64 user_ctl;
 
-	BUG_ON(priv == NULL);
 	ldev = priv->ldev;
 	BUG_ON(ldev == NULL);
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 18 lines · Aditya Pakki

In kpc_dma_transfer(), the assertion that priv is NULL is never satisfied. The two callers of the function, dereference the priv pointer before the call is executed. This patch removes the unnecessary BUG_ON call.

---
v1: Replace the recovery code by removing the assertion, as suggested by Greg Kroah-Hartman.

---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/kpc2000/kpc_dma/fileops.c +0 -0
index cb52bd9a6d2f..61d762535823 100644

drivers/staging/kpc2000/kpc_dma/fileops.c static int kpc_dma_transfer(struct dev_private_data *priv, · line 53

Quoted 6 lines
drivers/staging/kpc2000/kpc_dma/fileops.c +0 -1
@@ -49,7 +49,6 @@ static int kpc_dma_transfer(struct dev_private_data *priv,
 	u64 dma_addr;
 	u64 user_ctl;
 
-	BUG_ON(priv == NULL);
 	ldev = priv->ldev;
 	BUG_ON(ldev == NULL);

ldev is also obviously never NULL so you can remove that at the same time.

thanks,

greg k-h