lkml.org 
[lkml]   [2017]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 3/4] [media] cpia2: Delete unnecessary null pointer checks in free_sbufs()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Sun, 17 Sep 2017 13:23:47 +0200

    The script "checkpatch.pl" pointed information out like the following.

    WARNING: kfree(NULL) is safe and this check is probably not required

    Thus fix the affected source code place.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/media/usb/cpia2/cpia2_usb.c | 14 +++++---------
    1 file changed, 5 insertions(+), 9 deletions(-)

    diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
    index 161c9b827f8e..d1750fa48aa8 100644
    --- a/drivers/media/usb/cpia2/cpia2_usb.c
    +++ b/drivers/media/usb/cpia2/cpia2_usb.c
    @@ -519,15 +519,11 @@ static void free_sbufs(struct camera_data *cam)
    int i;

    for (i = 0; i < NUM_SBUF; i++) {
    - if(cam->sbuf[i].urb) {
    - usb_kill_urb(cam->sbuf[i].urb);
    - usb_free_urb(cam->sbuf[i].urb);
    - cam->sbuf[i].urb = NULL;
    - }
    - if(cam->sbuf[i].data) {
    - kfree(cam->sbuf[i].data);
    - cam->sbuf[i].data = NULL;
    - }
    + usb_kill_urb(cam->sbuf[i].urb);
    + usb_free_urb(cam->sbuf[i].urb);
    + cam->sbuf[i].urb = NULL;
    + kfree(cam->sbuf[i].data);
    + cam->sbuf[i].data = NULL;
    }
    }

    --
    2.14.1
    \
     
     \ /
      Last update: 2017-09-17 15:35    [W:7.400 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site