diff options
author | YueHaibing <yuehaibing@huawei.com> | 2018-11-23 09:54:55 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-12 19:47:01 +0100 |
commit | 3b07abf1cedffca88b51a116657a3a149935fc76 (patch) | |
tree | b2d1520036bdc4df8298fb87a1858c8f3296ac91 /drivers/ptp | |
parent | 2dbfc1cdb68a280227c9e90f265ecd1ddf30df1c (diff) | |
download | linux-stable-3b07abf1cedffca88b51a116657a3a149935fc76.tar.gz linux-stable-3b07abf1cedffca88b51a116657a3a149935fc76.tar.bz2 linux-stable-3b07abf1cedffca88b51a116657a3a149935fc76.zip |
ptp: Fix pass zero to ERR_PTR() in ptp_clock_register
[ 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 <yuehaibing@huawei.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_clock.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; } |