On Tue, 18 Aug 2020 09:10:56 +0000
Xu Wang [off-list ref] wrote:
quoted
Remove unnecassary casts in the argument to kfree.
Signed-off-by: Xu Wang <redacted>
You seem to have several of these patches, they should be sent in a
series with the series patch subject (for example):
[PATCH net-next 0/n] fix up casts on kfree
Did you use a coccinelle script to find these?
They could all have Fixes tags. I'd resend the whole bunch as a series.
Since this has no functional change, you could mention that in the
series commit message text.
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 2558cb680db3..961adb4d8910 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -482,24 +482,6 @@ int qed_fill_dev_info(struct qed_dev *cdev,
return 0;
}
-static void qed_free_cdev(struct qed_dev *cdev)
-{
- kfree((void *)cdev);
-}
-
-static struct qed_dev *qed_alloc_cdev(struct pci_dev *pdev)
-{
- struct qed_dev *cdev;
-
- cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
- if (!cdev)
- return cdev;
-
- qed_init_struct(cdev);
-
- return cdev;
-}
-
/* Sets the requested power state */
static int qed_set_power_state(struct qed_dev *cdev, pci_power_t state)
{@@ -618,9 +600,11 @@ static struct qed_dev *qed_probe(struct pci_dev *pdev,
struct qed_dev *cdev;
int rc;
- cdev = qed_alloc_cdev(pdev);
+ cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
if (!cdev)
- goto err0;
+ return NULL;
+
+ qed_init_struct(cdev);
cdev->drv_type = DRV_ID_DRV_TYPE_LINUX;
cdev->protocol = params->protocol;
@@ -658,8 +642,7 @@ static struct qed_dev *qed_probe(struct pci_dev *pdev,
err2:
qed_free_pci(cdev);
err1:
- qed_free_cdev(cdev);
-err0:
+ kfree(cdev);
return NULL;
}
@@ -676,7 +659,7 @@ static void qed_remove(struct qed_dev *cdev)
qed_devlink_unregister(cdev);
- qed_free_cdev(cdev);
+ kfree(cdev);
}
static void qed_disable_msix(struct qed_dev *cdev)