Skip to content

Commit

Permalink
hv_utils: Fix passing zero to 'PTR_ERR' warning
Browse files Browse the repository at this point in the history
[ Upstream commit c6a8625 ]

Sparse warn this:

drivers/hv/hv_util.c:753 hv_timesync_init() warn:
 passing zero to 'PTR_ERR'

Use PTR_ERR_OR_ZERO instead of PTR_ERR to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210514070116.16800-1-yuehaibing@huawei.com
[ wei: change %ld to %d ]
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
YueHaibing authored and gregkh committed Jul 14, 2021
1 parent 0f2f529 commit f8c3236
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hv/hv_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
*/
hv_ptp_clock = ptp_clock_register(&ptp_hyperv_info, NULL);
if (IS_ERR_OR_NULL(hv_ptp_clock)) {
pr_err("cannot register PTP clock: %ld\n",
PTR_ERR(hv_ptp_clock));
pr_err("cannot register PTP clock: %d\n",
PTR_ERR_OR_ZERO(hv_ptp_clock));
hv_ptp_clock = NULL;
}

Expand Down

0 comments on commit f8c3236

Please sign in to comment.