Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2649253imj; Mon, 11 Feb 2019 06:27:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IYG/c556OyT3dqF20kCJPMkLGjRqMrbasWHIEbJ+hTsDn2WgnQOInA+uVvx6Id8Upm7tAsJ X-Received: by 2002:a63:481f:: with SMTP id v31mr15377471pga.29.1549895257060; Mon, 11 Feb 2019 06:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895257; cv=none; d=google.com; s=arc-20160816; b=hIJhZvC5xdXOG/JC9okyE0tNHeOlEoJm7qR9Xq5K/h2ogx6FzM0mt1YxcKn5x4nWL2 i0aRR9/HId2uB6paRZK029AC92j5h6jK9YOi9bntJF/7WGU220zqemBaVaPJuTH2gYN3 DP332yLOrLhZ49ADj81Xyd4HIEBSvoKX4p62ms+DqlvaBv25BkNePwvtsgCrpx9+sjCM isZBy1+TvVhJfBpt3nn9aqSwbXo/HzdcjeRQ4y3QuwKXlmHqeeXiRdB+ikbx3yMsBrBz cAs3HDkP6Fjmnc7K3w78CSD/bOjBDc93h3QhRhIq6g+4BOdNbdTZWQAUStSzh3JmEUfC KhhA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xMOOW5nHzObCHgD33akm/WQEOCBGbsMGw9kNQueiUQQ=; b=bWj8O8eg+c3vKCBF8SjLIDIWzwWx1MLE1fcmHTbyFfyntOZG2nH6oSyNNYVeeTQ6mN nWCnlb+yz5u8pdHCgsZ+SOlB5cmO7SOB6Si0Z/Nj206+XE/RSyq4JhCCQLClb6p5C8tV zYFwoFu2+alhhBXIdRdAqyXNFFAuNBFJc4ciJiWogAj9kGSSk4Y6kUq8HW6A1l+pXNkd 1TzFLKph5wECB4sxI7wBsSq9SBuO1EHXon4RspEq8uPNXVdLupkrQixaM0ObWLBCiQ+y ebMOZkrEEwrLLfunTSC9uKmjl+bbgn/E9Gpt46lnRpqmj4sLoQy+uZDA642KfutDsoWL Qfnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WEPzmwE+; 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 j11si2628430pgk.265.2019.02.11.06.27.20; Mon, 11 Feb 2019 06:27:37 -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=WEPzmwE+; 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 S1729103AbfBKOYD (ORCPT + 99 others); Mon, 11 Feb 2019 09:24:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:57072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729092AbfBKOX7 (ORCPT ); Mon, 11 Feb 2019 09:23:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D97062075C; Mon, 11 Feb 2019 14:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895038; bh=2j35Vr51kleR2aLYsUoRvNwts6LsswN+IN/RaJhZP/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEPzmwE+SCD60X45f7oX+JRBdpYFSNZlfDZikHl2pJfu8snuT+0L41rsURIkVY7pP Kh3saKIh5E4DRS8Ryxi3kK+bEizYY3ILbvfca+2ns51MNSjn2Ml/oqWr39kx/w9v1C uyVaLIFIy7nURcEyLCISOhiDS4T5taGLYJXmV0Ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Richard Cochran , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 070/352] ptp: Fix pass zero to ERR_PTR() in ptp_clock_register Date: Mon, 11 Feb 2019 15:14:57 +0100 Message-Id: <20190211141850.551721755@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 5419a89d300e..9b8aa6718ee7 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -249,8 +249,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) { @@ -261,6 +263,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