LF-2108 rpmsg: imx: fix the pointer conversion loses bits issue
authorRichard Zhu <hongxing.zhu@nxp.com>
Fri, 23 Apr 2021 08:10:27 +0000 (16:10 +0800)
committerRichard Zhu <hongxing.zhu@nxp.com>
Mon, 26 Apr 2021 05:25:15 +0000 (13:25 +0800)
Fix the pointer conversion loses bits issue reported by Coverity below.
CID 5433934 (#2 of 4): Parse warning (PW.POINTER_CONVERSION_LOSES_BITS)
1. pointer_conversion_loses_bits: conversion from pointer to smaller integer

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
drivers/rpmsg/imx_rpmsg.c

index 6df9981..504010f 100644 (file)
@@ -534,6 +534,7 @@ err_out:
 static int imx_rpmsg_probe(struct platform_device *pdev)
 {
        int j, ret = 0;
+       unsigned long variant;
        char *buf;
        struct device *dev = &pdev->dev;
        struct device_node *np = pdev->dev.of_node;
@@ -551,7 +552,8 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
 #ifdef CONFIG_IMX_SCU
        rpdev->proc_nb.notifier_call = imx_rpmsg_partition_notify;
 #endif
-       rpdev->variant = (enum imx_rpmsg_variants)of_device_get_match_data(dev);
+       variant = (uintptr_t)of_device_get_match_data(dev);
+       rpdev->variant = (enum imx_rpmsg_variants)variant;
        rpdev->rx_buffer.buf = buf;
        rpdev->rx_buffer.head = 0;
        rpdev->rx_buffer.tail = 0;