Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3625318imu; Mon, 28 Jan 2019 08:03:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7/xCK9fhffxRopnDyLifAAUy1cg7ODeBcMg0qTJi7o/EYZR1F4glMZ4x/8qPMRrUuuRwiR X-Received: by 2002:a63:e051:: with SMTP id n17mr20405911pgj.258.1548691406108; Mon, 28 Jan 2019 08:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691406; cv=none; d=google.com; s=arc-20160816; b=l6BmlwJEfN/n8tvMSkQlei+bx78uTGfFn4IngFD0/BA83bw7cudNMW9dvBqWbU7HPu JNHIZomNV8dZjO+wSQgmWElb50C0DYVJFs+tvkrNzCfWjigjhdP21bmGWboXJ8iyXF9y biBXBd6cpyQGsNdV/oOsVxKwSMu2KMVsjpNVesY4RwdWMeWUCJUfDK60bApynbqM7egQ rZIGkUNrfuwGCbgeoNAFaaYaDQDubAGASW6+g0xRMDmNNfgaPG3KCuT192BI1/rrjfiE fP9kppNo7IU6P9/fQtJazHWtk6I/zmSEyjT7Sz5KgEMjvpDn5dqfVlFt0nSSrsQYAG3J tbVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rgyxy/3pYfpGAD/RKHdFD0TvYUJgKFamdj8vSPMNLD0=; b=PHLtuSaP8uO4ZVWFgQdE8AAW/ezH2PKDui6hlzzMntAoxLTu5j8ZDa87QaS0Tmv3/Z gKK4XPjVsynKAzqZv3KsItJOBzzLGPyP9OTOuVI1vaUj2UX6CtsticizGlLfaLt7miWB vOFnyaTGhrXPEbXn3IwH8NiaM7bZ1DUOuMNaUnBpd9v89/8DDRrRj4ot7TL+mNoD+euP E+vhhPx7OPy1l14HfyUNEA1sLcZRDPO2xN7bIIoJYlnFsLvUfuITcFhFQUgYaEBrAccQ 8WV36WF0PWX8U1d0nzVDElcq5K2PSooMOFagXmNMxxX0kFmBDk+FkYhxVd9E6fslpSzx 2r4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iXgAVzNA; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si36035097pla.20.2019.01.28.08.03.10; Mon, 28 Jan 2019 08:03:26 -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=@kernel.org header.s=default header.b=iXgAVzNA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731224AbfA1QC1 (ORCPT + 99 others); Mon, 28 Jan 2019 11:02:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:47736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730192AbfA1QCZ (ORCPT ); Mon, 28 Jan 2019 11:02:25 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BED8E21919; Mon, 28 Jan 2019 16:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691345; bh=Bxa89QOkNkRSADIzZ11duJ7gv7guCurt3wYLSWR4czw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iXgAVzNAE6uBxGk6JEF5IB2SvxczOUVU+dJB5AHKs+BdSMIIAqsvECynSYOORFUVr uqi9Glh20cM5z/mYP2pYjszq+VCcgh+lRhVYrDijtjPQrnASPOkF+H5mrSCpMEtMST teW0TTxlaOs0f+d3J0vL/msLDc62iiQXPrc/d45M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: YueHaibing , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 063/258] ptp: Fix pass zero to ERR_PTR() in ptp_clock_register Date: Mon, 28 Jan 2019 10:56:09 -0500 Message-Id: <20190128155924.51521-63-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit aea0a897af9e44c258e8ab9296fad417f1bc063a ] Fix smatch warning: drivers/ptp/ptp_clock.c:298 ptp_clock_register() warn: passing zero to 'ERR_PTR' 'err' should be set while device_create_with_groups and pps_register_source fails Fixes: 85a66e550195 ("ptp: create "pins" together with the rest of attributes") Signed-off-by: YueHaibing Acked-by: Richard Cochran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/ptp/ptp_clock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 7eacc1c4b3b1..c64903a5978f 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -253,8 +253,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid, ptp, ptp->pin_attr_groups, "ptp%d", ptp->index); - if (IS_ERR(ptp->dev)) + if (IS_ERR(ptp->dev)) { + err = PTR_ERR(ptp->dev); goto no_device; + } /* Register a new PPS source. */ if (info->pps) { @@ -265,6 +267,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, pps.owner = info->owner; ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS); if (!ptp->pps_source) { + err = -EINVAL; pr_err("failed to register pps source\n"); goto no_pps; } -- 2.19.1