pps: using ERR_PTR instead of NULL while pps_register_source fails

pps_register_source() has keeps error codes in a local variable,
but it does not make use of the code. This patch let it return
the errcode in case of failure.

Suggested-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
YueHaibing
2018-11-26 18:24:22 +08:00
committed by Greg Kroah-Hartman
parent eb30abeede
commit 3b1ad360ac
5 changed files with 10 additions and 9 deletions

View File

@ -72,7 +72,8 @@ static void pps_echo_client_default(struct pps_device *pps, int event,
* source is described by info's fields and it will have, as default PPS
* parameters, the ones specified into default_params.
*
* The function returns, in case of success, the PPS device. Otherwise NULL.
* The function returns, in case of success, the PPS device. Otherwise
* ERR_PTR(errno).
*/
struct pps_device *pps_register_source(struct pps_source_info *info,
@ -135,7 +136,7 @@ kfree_pps:
pps_register_source_exit:
pr_err("%s: unable to register source\n", info->name);
return NULL;
return ERR_PTR(err);
}
EXPORT_SYMBOL(pps_register_source);