[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_E823831C300BE6E670B851B086F7294DFD0A@qq.com>
Date: Tue, 14 Dec 2021 23:51:15 +0800
From: "Xiaoke Wang" <xkernel.wang@...mail.com>
To: "Mauro Carvalho Chehab"
<mchehab+huawei@...nel.org>
Cc: "crope" <crope@....fi>,
"linux-media" <linux-media@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: usb: dvb-usb-v2: check the return value of kstrdup()
On Tue, Dec 14, 2021 11:03 PM +0800, Mauro Carvalho Chehab wrote:
>> + if (!devname)
>> + dev_err(&d->udev->dev, "%s: kstrdup() failed\n", KBUILD_MODNAME);
>> +
> Don't use KBUILD_MODNAME, as dev_err will already add the driver/device's
> name.
Here I know I need to change it to: dev_err(&d->udev->dev, "kstrdup() failed\n");
>> - pr_info("%s: '%s:%s' successfully deinitialized and disconnected\n",
>> - KBUILD_MODNAME, drvname, devname);
>
> Better to use:
> dev_dbg(&d->udev->dev, "successfully deinitialized and disconnected\n");
>
>> - kfree(devname);
> No need to place kfree() inside an if, as kfree(NULL) is safe.
Here I know I need to put kfree() at the end of this function.
However, if I replace the original pr_info(...) with:
> dev_dbg(&d->udev->dev, "successfully deinitialized and disconnected\n");
Then devname and drvname seems can be all removed, as they are useless
in dvb_usbv2_disconnect() anymore. I am not sure if I understand correctly.
If so, I will just remove them and change pr_info() -> dev_dbg() in next
version.
Powered by blists - more mailing lists