Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp673260imm; Fri, 21 Sep 2018 06:31:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZtM3LroDlGsM2B1m2KqT7vjxsRTDdbFGqa+m6weAxEXkEFvxh9oR7FV6AhM+s6jrFNx0FF X-Received: by 2002:a62:5b85:: with SMTP id p127-v6mr46666548pfb.33.1537536691988; Fri, 21 Sep 2018 06:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537536691; cv=none; d=google.com; s=arc-20160816; b=FpwFxSoS/zXRq4QKcoMt++s0vKuTPREZmoQxe0SLxU5HzHi543PihCGsTAcoodsTnD Au0cDzJ+7XYcBCXgmPbSgPCl/WknWNSrbwOJNcM0IPvR/rpg7px79P/r9U1Hcfde6L5Q qAShGcLc3AlAImbKEIxI5RrlO4DmHCI7dAvP1GU6JS1LoPUbspOCPeTyIs7zXNz5vW70 B9E+Gr8bLi5eYyqVno7WfulElEsQ+RYooPGKgANwZjTifMp3P+MdrFLGyvKfzipG9QKU JOI2GxGg4zyAdeIGuoJJlYbX010Qr+B/Q6RJz6Ht7/fbae2S6yzMe4e8PhItt0znyu26 A0bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=/XL7HqTlDma8rkZPnJGcyq8ZrM9RJZqWqDz7RWYbcEs=; b=Pyox+qCuv7aP0dwMGOf+x29DOenZW8ry2nY0Tz2xtyBp277QR+HJO98fYXukwJeSOe BMEzpkKnLrqfCYBTN2yXA/GTHLBMa5lnyrO7Usl3VVSMvhpFxfGi5N0KFlZWyfDeiPBI aS5gecEVlrzBSlfjxCpSlRMo7ZW9by1N3sb2zP9RJaLwy1stKSddTMNIwW/zmnaaqrle ytX+sTakF2p2jh25pLmeGUkZfvMYG7QaVhcFWkZI5Xk994ALIIo3a3LD8a/TJxcYtAh0 1ja5AJouHODV3LhuXIfxgzgqTjkgWDt3iD69xuWi2qaaIKirVYLKWsuOrb3HRxURzloy NKNw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k190-v6si25888300pgd.80.2018.09.21.06.31.15; Fri, 21 Sep 2018 06:31:31 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389683AbeIUTUD (ORCPT + 99 others); Fri, 21 Sep 2018 15:20:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:41599 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727554AbeIUTUD (ORCPT ); Fri, 21 Sep 2018 15:20:03 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 966FE3A0279A8; Fri, 21 Sep 2018 21:31:06 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 21:31:05 +0800 From: zhong jiang To: , CC: , , Subject: [PATCH] PM / devfreq: remove redundant null pointer check before kfree Date: Fri, 21 Sep 2018 21:18:43 +0800 Message-ID: <1537535923-46240-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree. Signed-off-by: zhong jiang --- drivers/devfreq/devfreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 4c49bb1..c37021d 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -675,8 +675,7 @@ struct devfreq *devfreq_add_device(struct device *dev, device_unregister(&devfreq->dev); devfreq = NULL; err_dev: - if (devfreq) - kfree(devfreq); + kfree(devfreq); err_out: return ERR_PTR(err); } -- 1.7.12.4