mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com>,
	gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] Staging: rtl8723bs: os_dep: Fix assignment in if condition
Date: Sat, 09 Mar 2019 10:39:32 -0800	[thread overview]
Message-ID: <d57e41f96a23f63aeb720d0ea73ba2b2bed0a938.camel@perches.com> (raw)
In-Reply-To: <20190309183047.10781-2-gui.maeoka@gmail.com>

On Sat, 2019-03-09 at 15:30 -0300, Guilherme Tadashi Maeoka wrote:
> Fix an assignment in if condition.
> 
> Signed-off-by: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/osdep_service.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> index 73b87da15eb2..c7fdcc6bbae3 100644
> --- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> +++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
> @@ -162,7 +162,9 @@ static int retriveFromFile(char *path, u8 *buf, u32 sz)
>  	struct file *fp;
>  
>  	if (path && buf) {
> -		if (0 == (ret =openFile(&fp, path, O_RDONLY, 0))) {
> +		ret = openFile(&fp, path, O_RDONLY, 0);
> +
> +		if (ret == 0) {
>  			DBG_871X("%s openFile path:%s fp =%p\n", __func__, path , fp);
>  
>  			oldfs = get_fs(); set_fs(KERNEL_DS);

More common kernel style would be to rewrite the function
(and to fix the typo of retrieve) to something like:  

static int retrieveFromFile(char *path, u8 *buf, u32 sz)
{
	int ret;
	mm_segment_t oldfs;
	struct file *fp;

	if (!path || !buf) {
		DBG_871X("%s NULL pointer\n", __func__);
		return -EINVAL;
	}

	ret = openFile(&fp, path, O_RDONLY, 0);
	if (ret) {
		DBG_871X("%s openFile path:%s Fail, ret:%d\n",
			 __func__, path, ret);
		return ret;
	}

	DBG_871X("%s openFile path:%s fp =%p\n", __func__, path , fp);

	oldfs = get_fs();
	set_fs(KERNEL_DS);
	ret = readFile(fp, buf, sz);
	set_fs(oldfs);
	closeFile(fp);

	DBG_871X("%s readFile, ret:%d\n", __func__, ret);

	return ret;
}



  reply	other threads:[~2019-03-09 18:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09 18:30 [PATCH 0/5] Fix several coding style errors Guilherme Tadashi Maeoka
2019-03-09 18:30 ` [PATCH 1/5] Staging: rtl8723bs: os_dep: Fix assignment in if condition Guilherme Tadashi Maeoka
2019-03-09 18:39   ` Joe Perches [this message]
2019-03-09 19:00     ` Guilherme T Maeoka
2019-03-17 11:39   ` Greg KH
2019-03-09 18:30 ` [PATCH 2/5] Staging: rtl8723bs: os_dep: Fix space required coding style Guilherme Tadashi Maeoka
2019-03-09 18:30 ` [PATCH 3/5] Staging: rtl8723bs: os_dep: Fix else to follow close brace Guilherme Tadashi Maeoka
2019-03-09 18:30 ` [PATCH 4/5] Staging: rtl8723bs: os_dep: Fix space in pointer definition Guilherme Tadashi Maeoka
2019-03-09 18:30 ` [PATCH 5/5] Staging: rtl8723bs: os_dep: Set constant on right side Guilherme Tadashi Maeoka
2019-03-17 11:07 ` [PATCH 0/5] Fix several coding style errors Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d57e41f96a23f63aeb720d0ea73ba2b2bed0a938.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gui.maeoka@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome