Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4093971rwe; Mon, 17 Apr 2023 07:55:36 -0700 (PDT) X-Google-Smtp-Source: AKy350bNWKmoNegVaUTbuHm9Mh+FAwroZsnL0NQmx2gkyFgENviU+yNXxxFd5QEzNpO+U3CeQ7N1 X-Received: by 2002:a05:6a20:499d:b0:db:7055:d4e9 with SMTP id fs29-20020a056a20499d00b000db7055d4e9mr12193967pzb.27.1681743335949; Mon, 17 Apr 2023 07:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681743335; cv=none; d=google.com; s=arc-20160816; b=WZNk5Ma1SE5dQRWc5MgrKNDTcikgMWQg/8oZv9DMogVMNgtAW5g4ZeGKOUKfEJxc9A buJP2ncBFP7VbSgAIuzWnfFiKxVLEXViouJnTNMRo6VCrOJ4jFQNHPwoRNngM8I1pgFF MnNvG6W/IzWbG2lyML5p8EQax5kFN2RRbvIHxSSTTDHAqHhwUUjEOoWJhd1PVOMCuDni 9CNrnTO5SWyWpJsK4BDiGvqtsLGFn3lzQMPqNUI5dYRGCtYoysvy35qBLUSpLA4xMhsQ kMmJkyvwvmbO7OCNQmVHSueew7ATO5dHtxXfVodP6FKNuHXGgPeEJZnlYSmimpq26wo8 na5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=5qzd+c0AETChtvpI0vuLSbl7U7FbPzJnd0FfoOEhIaE=; b=VgcCZ4Hqtbs44oK2MGQEZaQ96vFmPpVXCukicSAoqSSXxaYM13e2E09D/YXId7arCF aarzn+nfkuEyEJ1srZmSMXEW1ULFWuf6SfT0LkT3l/pSZ6yBxcgYwD0sBvLZx5eiAHL0 7TpyCrjvVMHTOKVod2CsiVFtaWLTBP2gZkM1Sa87ShuI55rutVdRChYzq/YZJ5B9cAB2 GSoFt6qgdXR+/yikpciiwjIGyS73RXJaA+cSiM1veCJRmYDZIAr6OMyQb7/CKpCa6vpB cOO/rio2uHINm/Upr9Z3NASwvZJoheeP+C7Lxi5ImrHcblWVxm4AnaXx6FKzpq46kP4z nCdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=d83kJ4LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a635b44000000b0051aed25131asi12012563pgm.252.2023.04.17.07.55.17; Mon, 17 Apr 2023 07:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=d83kJ4LE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbjDQOn2 (ORCPT + 99 others); Mon, 17 Apr 2023 10:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbjDQOn1 (ORCPT ); Mon, 17 Apr 2023 10:43:27 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C551B742 for ; Mon, 17 Apr 2023 07:43:06 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33HCtV7Z007267; Mon, 17 Apr 2023 14:42:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type; s=qcppdkim1; bh=5qzd+c0AETChtvpI0vuLSbl7U7FbPzJnd0FfoOEhIaE=; b=d83kJ4LEVgpDwRbJIfScjM0ci2P9l7VFJg8STkWtX1Vk3RhnMg62DLAte+wcJjjZFwSK hpSsm6R9SirIQawc0FyNmpR2dqj/AfCB+IlEOlukxyt/pHw5VLULAc3tfvUdChjHlC2c ITR9VKacjAJ2zNVsl58jupmLNDC7p45UCZ88Pgr97wkplcGVXEy7dBi30E/iPtowZYUa 7lg9FVQX+mpQKjsyca6+WYXrWD1K5YUmMd3pYM4wwmLs301Jnbc0yCr8D5BiWxb2icOM a50Wbo2dPAZtv0/Zxdy2yUwKnfPQeaZ2POWtcH/iSPuUCwEcKzPnzQwBU45j516VpQsz UQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q11er8y0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 14:42:51 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33HEgnI2002301 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 14:42:50 GMT Received: from kvalo10 (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 17 Apr 2023 07:42:41 -0700 From: Kalle Valo To: Dan Carpenter CC: , , , , Subject: Re: drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR' References: <278dae1d-0cc2-4963-b7f0-5d611a5b31a4@kili.mountain> Date: Mon, 17 Apr 2023 17:42:38 +0300 In-Reply-To: <278dae1d-0cc2-4963-b7f0-5d611a5b31a4@kili.mountain> (Dan Carpenter's message of "Sat, 15 Apr 2023 16:15:07 +0300") Message-ID: <87o7nm4lk1.fsf@kvalo10.eu.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: H9A4xvmLo5N9w1APDOkTIhTehPqH1_oK X-Proofpoint-ORIG-GUID: H9A4xvmLo5N9w1APDOkTIhTehPqH1_oK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-17_08,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 spamscore=0 mlxlogscore=429 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170131 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + ath11k list Including the full report below. Kalle Dan Carpenter writes: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 7a934f4bd7d6f9da84c8812da3ba42ee10f5778e > commit: 323d91d4684d238f6bc3693fed93caf795378fe0 wifi: ath11k: debugfs: fix to work with multiple PCI devices > config: openrisc-randconfig-m041-20230414 > (https://download.01.org/0day-ci/archive/20230415/202304152142.ssXYxFdQ-lkp@intel.com/config) > compiler: or1k-linux-gcc (GCC) 12.1.0 > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > | Link: https://lore.kernel.org/r/202304152142.ssXYxFdQ-lkp@intel.com/ > > New smatch warnings: > drivers/net/wireless/ath/ath11k/debugfs.c:1009 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR' > > Old smatch warnings: > drivers/net/wireless/ath/ath11k/debugfs.c:1022 ath11k_debugfs_soc_create() warn: passing zero to 'PTR_ERR' > > vim +/PTR_ERR +1009 drivers/net/wireless/ath/ath11k/debugfs.c > > cb4e57db2ff0c8 Kalle Valo 2020-09-16 998 int ath11k_debugfs_soc_create(struct ath11k_base *ab) > da3a9d3c15769b Kalle Valo 2020-09-16 999 { > 323d91d4684d23 Kalle Valo 2022-12-22 1000 struct dentry *root; > 323d91d4684d23 Kalle Valo 2022-12-22 1001 bool dput_needed; > 323d91d4684d23 Kalle Valo 2022-12-22 1002 char name[64]; > 323d91d4684d23 Kalle Valo 2022-12-22 1003 int ret; > 323d91d4684d23 Kalle Valo 2022-12-22 1004 > 323d91d4684d23 Kalle Valo 2022-12-22 1005 root = debugfs_lookup("ath11k", NULL); > 323d91d4684d23 Kalle Valo 2022-12-22 1006 if (!root) { > 323d91d4684d23 Kalle Valo 2022-12-22 1007 root = debugfs_create_dir("ath11k", NULL); > 323d91d4684d23 Kalle Valo 2022-12-22 1008 if (IS_ERR_OR_NULL(root)) > 323d91d4684d23 Kalle Valo 2022-12-22 @1009 return PTR_ERR(root); > > Debugfs used to return a mix of error pointers and NULL but we changed > the NULL return to an error pointer to encourage people to just delete > all debugfs error handling code. > > 323d91d4684d23 Kalle Valo 2022-12-22 1010 > 323d91d4684d23 Kalle Valo 2022-12-22 1011 dput_needed = false; > 323d91d4684d23 Kalle Valo 2022-12-22 1012 } else { > 323d91d4684d23 Kalle Valo 2022-12-22 1013 /* a dentry from lookup() > needs dput() after we don't use it */ > 323d91d4684d23 Kalle Valo 2022-12-22 1014 dput_needed = true; > 323d91d4684d23 Kalle Valo 2022-12-22 1015 } > 323d91d4684d23 Kalle Valo 2022-12-22 1016 > 323d91d4684d23 Kalle Valo 2022-12-22 1017 scnprintf(name, sizeof(name), "%s-%s", ath11k_bus_str(ab->hif.bus), > 323d91d4684d23 Kalle Valo 2022-12-22 1018 dev_name(ab->dev)); > da3a9d3c15769b Kalle Valo 2020-09-16 1019 > 323d91d4684d23 Kalle Valo 2022-12-22 1020 ab->debugfs_soc = debugfs_create_dir(name, root); > 323d91d4684d23 Kalle Valo 2022-12-22 1021 if (IS_ERR_OR_NULL(ab->debugfs_soc)) { > 323d91d4684d23 Kalle Valo 2022-12-22 1022 ret = PTR_ERR(ab->debugfs_soc); > 323d91d4684d23 Kalle Valo 2022-12-22 1023 goto out; > 323d91d4684d23 Kalle Valo 2022-12-22 1024 } > 323d91d4684d23 Kalle Valo 2022-12-22 1025 > 323d91d4684d23 Kalle Valo 2022-12-22 1026 ret = 0; > 323d91d4684d23 Kalle Valo 2022-12-22 1027 > 323d91d4684d23 Kalle Valo 2022-12-22 1028 out: > 323d91d4684d23 Kalle Valo 2022-12-22 1029 if (dput_needed) > 323d91d4684d23 Kalle Valo 2022-12-22 1030 dput(root); > 323d91d4684d23 Kalle Valo 2022-12-22 1031 > 323d91d4684d23 Kalle Valo 2022-12-22 1032 return ret; > da3a9d3c15769b Kalle Valo 2020-09-16 1033 }