LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org> To: Nishka Dasgupta <nishkadg.linux@gmail.com> Cc: colin.king@canonical.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] staging: gdm724x: Remove variable Date: Fri, 24 May 2019 08:54:27 +0200 [thread overview] Message-ID: <20190524065427.GB3600@kroah.com> (raw) In-Reply-To: <20190524060026.3763-2-nishkadg.linux@gmail.com> On Fri, May 24, 2019 at 11:30:26AM +0530, Nishka Dasgupta wrote: > The return variable is used only twice (in two different branches), and > both times it is assigned the same constant value. These can therefore > be merged into the same assignment, placed at the point that both > these branches (and no other) go to. The return variable itself can be > removed. > Issue found with Coccinelle. > > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> > --- > drivers/staging/gdm724x/gdm_usb.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) Your subject line needs a lot of work. How about: staging: gdm724x: remove unneeded variable in init_usb() > > diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c > index d023f83f9097..8145ae2afba7 100644 > --- a/drivers/staging/gdm724x/gdm_usb.c > +++ b/drivers/staging/gdm724x/gdm_usb.c > @@ -295,7 +295,6 @@ static void release_usb(struct lte_udev *udev) > > static int init_usb(struct lte_udev *udev) > { > - int ret = 0; > int i; > struct tx_cxt *tx = &udev->tx; > struct rx_cxt *rx = &udev->rx; > @@ -326,7 +325,6 @@ static int init_usb(struct lte_udev *udev) > for (i = 0; i < MAX_NUM_SDU_BUF; i++) { > t_sdu = alloc_tx_sdu_struct(); > if (!t_sdu) { > - ret = -ENOMEM; > goto fail; > } > > @@ -337,7 +335,6 @@ static int init_usb(struct lte_udev *udev) > for (i = 0; i < MAX_RX_SUBMIT_COUNT * 2; i++) { > r = alloc_rx_struct(); > if (!r) { > - ret = -ENOMEM; > goto fail; > } > > @@ -349,7 +346,7 @@ static int init_usb(struct lte_udev *udev) > return 0; > fail: > release_usb(udev); > - return ret; > + return -ENOMEM; > } Again, you are getting _really_ close to the "churn for churn sake". Maybe this is needed, but it's really a fine line... thanks, greg k-h
next prev parent reply other threads:[~2019-05-24 6:54 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-24 6:00 [PATCH 1/2] staging: gdm724x: Remove initialisation Nishka Dasgupta 2019-05-24 6:00 ` [PATCH 2/2] staging: gdm724x: Remove variable Nishka Dasgupta 2019-05-24 6:54 ` Greg KH [this message] 2019-05-25 13:28 ` Sven Van Asbroeck 2019-05-24 6:54 ` [PATCH 1/2] staging: gdm724x: Remove initialisation 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=20190524065427.GB3600@kroah.com \ --to=gregkh@linuxfoundation.org \ --cc=colin.king@canonical.com \ --cc=devel@driverdev.osuosl.org \ --cc=linux-kernel@vger.kernel.org \ --cc=nishkadg.linux@gmail.com \ /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: linkBe 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; as well as URLs for NNTP newsgroup(s).