On Tue, 2020-08-18 at 11:44 -0700, Jesse Brandeburg wrote:
> On Tue, 18 Aug 2020 09:10:56 +0000
> Xu Wang <vu...@iscas.ac.cn> wrote:
> 
> > Remove unnecassary casts in the argument to kfree.
> > 
> > Signed-off-by: Xu Wang <vu...@iscas.ac.cn>
> 
> 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.

Commits with no functional change generally should
not be marked with Fixes:

And some wrapper functions might as well be removed
and just kfree used in-place instead.

Something like:
---
 drivers/net/ethernet/qlogic/qed/qed_main.c | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

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)


Reply via email to