Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2117595ybf; Mon, 2 Mar 2020 02:17:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzDCRwktnWrATY7YBWBHc5fIrbXOx0zD+xY5OoVsZcY0abHDjd2kKuWCQpXwFP9z2t4PR+u X-Received: by 2002:aca:c256:: with SMTP id s83mr11342317oif.57.1583144227674; Mon, 02 Mar 2020 02:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583144227; cv=none; d=google.com; s=arc-20160816; b=HC+zSsYI8PmmWrRfe+gNfLmwaVuQWpCVj8u0z9vNKnoPnjCVp8rUr4qJZXTgVAKvfv irbNNFT9tHbtC/RzjJk09aYVzi2l3S0jxaUB+wSp9DOyfIwq/BZQ803Jy4URbVX73sWJ dvSb7Mr9CSzdarTsiTJbV9ZntolYmc7iyz/SWl2iLYx/w7IAyKMwxfSed4OiWlaOS+V5 4YRsJ1/EgsVChUx8XuAPOCGaSuP9ppgeRgHTv/J4+2J7Jw/NtGRAZOexMVGO1+VktevV jMSW4VIAIuXtQ/ecJLU6ikX9kseml3eXQVoGF44QpS+faPLot1HuJiXnMntQ4Nzx2/C8 swCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IXo+jOnMJnVg0BdBfAq0eKhEwbhNb8AEFiily5Isa3s=; b=BFsZGZEIrCP86f+w5LhiTU2/Qsfu0kYs0Y1wxKbAoyLxIThM2lG5ctejiUD37dxsQr TDgfJH/Bf3ykiwOTerGHMMYCMkvkYOrn54p1i7udYyvIw5UGgHeYnwaALkqhiwYWSQ0B M+f4bGBQh8mqFmSSaXttgcLFnL28UA79hUQnYvMOCLZVIbV90JA+4/O0/nnY13SL7uca aNLNF2vGZhycjCeXarmspdHM23COoEBcH5EmtwUM+1yCL+dQTt7qSmKUbnZ5zjvSKLVC BR6RfmkosOXgiHQTAwken1Oe2AfzdogMoSE0z2rOmsIzXgEP/MfK1K5B2m520jaB882H y+iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Lz48/6Mr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v92si1939445otb.160.2020.03.02.02.16.55; Mon, 02 Mar 2020 02:17:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Lz48/6Mr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbgCBKQo (ORCPT + 99 others); Mon, 2 Mar 2020 05:16:44 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:55202 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727027AbgCBKQo (ORCPT ); Mon, 2 Mar 2020 05:16:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583144203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IXo+jOnMJnVg0BdBfAq0eKhEwbhNb8AEFiily5Isa3s=; b=Lz48/6MrklQ1TgrAYgUnMvL5H84FnwqamDiw5QpMRvpI+KhLtT1OYWTXsdQKZb4YrC553c pjGPssl6LbEcGWewxswEoLeP2tbCoQn2oasM5FaaNaSExMpoWniYULBixvqkNzdj+wCSl+ W1q7crQ1fFotjylPUNKyInhDV5VEHTs= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-9l02Ge80Nl22PEqgJcRN4Q-1; Mon, 02 Mar 2020 05:16:41 -0500 X-MC-Unique: 9l02Ge80Nl22PEqgJcRN4Q-1 Received: by mail-qk1-f197.google.com with SMTP id d2so8550682qko.3 for ; Mon, 02 Mar 2020 02:16:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IXo+jOnMJnVg0BdBfAq0eKhEwbhNb8AEFiily5Isa3s=; b=NPFSZCVY3kRXW4LFp3xL0UXQfG/iA1BevLnQYjUMlVhsyJDuB+Fi2WLXbPdKOJ/m7c 0P/LEEartp/60MbNBbNO6wOTNuCuXoRJK4ko+jlnbqD6HhZ3M2BC04979xBdXrBDmhHm NRBDykKn+OBv41fg7NrekMDiHPZZvVXzAteR7LIYLMACpMVsnZ5r+jcxv+mWs4tFPP0e nhHXjFT1ti16Fl4VlXpoAzyS3SfHRRf85E5Gg9siXi8XiCPt8zR8i/yV46msAnS2TZil DQLLhPuneMjV/E7FF7kaTfRTO7AC7zvvYD6BPb1NuOC190Ddy/nYQ2hoSmfjf7x1v+SX o1vw== X-Gm-Message-State: ANhLgQ3jZU3QSKU4lesiL7DtI+9rqxZtjNapnXehks4RBYE+5YYpn/Ue 7bRVivu/tbxeAoRxJH17ksv3OV7F59GyVLF5t2EgQXoTyhmums6Ks7DUBxIFSKOcjkznqnwgXud YpInaas7dalTHbORbqlLJwmRke172vSQZmoDeYTaB X-Received: by 2002:a05:620a:1517:: with SMTP id i23mr7903639qkk.459.1583144201401; Mon, 02 Mar 2020 02:16:41 -0800 (PST) X-Received: by 2002:a05:620a:1517:: with SMTP id i23mr7903622qkk.459.1583144201197; Mon, 02 Mar 2020 02:16:41 -0800 (PST) MIME-Version: 1.0 References: <20200229173007.61838-1-tanure@linux.com> In-Reply-To: <20200229173007.61838-1-tanure@linux.com> From: Benjamin Tissoires Date: Mon, 2 Mar 2020 11:16:30 +0100 Message-ID: Subject: Re: [PATCH] HID: hyperv: NULL check before some freeing functions is not needed. To: Lucas Tanure Cc: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Jiri Kosina , linux-hyperv@vger.kernel.org, "open list:HID CORE LAYER" , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 29, 2020 at 6:30 PM Lucas Tanure wrote: > > Fix below warnings reported by coccicheck: > drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed. > drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed. > > Signed-off-by: Lucas Tanure > --- Acked-by: Benjamin Tissoires Sasha, do you prefer taking this through your tree or through the HID one. I don't think we have much scheduled for hyperv, so it's up to you. Cheers, Benjamin > drivers/hid/hid-hyperv.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c > index dddfca555df9..0b6ee1dee625 100644 > --- a/drivers/hid/hid-hyperv.c > +++ b/drivers/hid/hid-hyperv.c > @@ -193,8 +193,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, > goto cleanup; > > /* The pointer is not NULL when we resume from hibernation */ > - if (input_device->hid_desc != NULL) > - kfree(input_device->hid_desc); > + kfree(input_device->hid_desc); > input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC); > > if (!input_device->hid_desc) > @@ -207,8 +206,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, > } > > /* The pointer is not NULL when we resume from hibernation */ > - if (input_device->report_desc != NULL) > - kfree(input_device->report_desc); > + kfree(input_device->report_desc); > input_device->report_desc = kzalloc(input_device->report_desc_size, > GFP_ATOMIC); > > -- > 2.25.1 >