Re: [PATCH 2/2] staging: unisys: remove comparison

From: Greg Kroah-Hartman
Date: Thu Mar 12 2015 - 10:22:31 EST


On Thu, Mar 12, 2015 at 07:44:21PM +0530, Sudip Mukherjee wrote:
> the macro comparison is always true as MAJOR is defined as
> unsiged int.
>
> Signed-off-by: Sudip Mukherjee <sudip@xxxxxxxxxxxxxxx>
> ---
> drivers/staging/unisys/visorchipset/file.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c
> index 9ca7f1e..a1e8e79 100644
> --- a/drivers/staging/unisys/visorchipset/file.c
> +++ b/drivers/staging/unisys/visorchipset/file.c
> @@ -82,10 +82,8 @@ visorchipset_file_cleanup(void)
> cdev_del(&file_cdev);
> file_cdev.ops = NULL;
> if (registered) {
> - if (MAJOR(majordev) >= 0) {
> - unregister_chrdev_region(majordev, 1);
> - majordev = MKDEV(0, 0);
> - }
> + unregister_chrdev_region(majordev, 1);
> + majordev = MKDEV(0, 0);

If this is really true, then why is someone trying to assign -1 to
majordev at the top of the file? :)

I suggest you fix this up properly, not by papering over the bug.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/